Email Pending Posts – Wordpress Plugin

22nd August 2009 at 21:19 | 6 COMMENTS

Email pending posts is a Wordpress plugin that I wrote, which will email a notification to the admin email of the blog, when a post’s status has been changed from DRAFT to PENDING.  This may be a useful feature for moderated multi-author Wordpress blogs, wherein contributors may write and SUBMIT FOR REVIEW, for a user with publication privileges to publish the post.

Download

emailpendingposts_ver0-2.php.zip 1.5 KB [Stable] … Tested with Wordpress 2.8.4

Installation

  1. Unzip “emailpendingposts_ver0-2.php.zip” and upload “emailpendingposts_ver0-2.php” to the “…/wp-content/plugins/” directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

No further action is necessary and there are no associated settings.  It will send an email notification when a post has been submitted for review and its status is PENDING; similar to the notification sent when a comment is awaiting moderation.

License

This plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3 (GPLv3). See http://www.gnu.org/licenses/ for more information.

Use and Enjoy

  • If you use it, a link to your blog in the comments would be good
  • If you wish to develop on this plugin, please do and let me know the link so that I can publish it here.

Plugin Code


/*
Plugin Name: Email Pending Posts
Plugin URI: http://www.fayid.com/20090822/email-pending-posts-wordpress-plugin/
Version: 0.2
Author: Fayid
Description: This plugin will email a notification when a post has been submitted for review, pending publication. Useful for moderated multi-author blogs.
*/
?>

/*
LICENCE: GNU GPLv3

Emailpendingposts.php - A Wordpress plugin: Emails notification of posts submitted for review.
Copyright (C) 2009 Fayid

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 3 (GPLv3).

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

See http://www.gnu.org/licenses/ for more information.
*/
?>

function fayid_emailpendingposts($post_ID) {

$blogtitle = get_bloginfo('name');
$installedurl = get_bloginfo('wpurl');
$editposturl = $installedurl."/wp-admin/edit.php";

$pendingpost = get_post($post_ID);
$posttitle = $pendingpost->post_title;
$poststatus = $pendingpost->post_status;
$postcontent = $pendingpost->post_content;

$postauthorid = $pendingpost->post_author;
$authorinfo = get_userdata($postauthorid);
$authorname = $authorinfo->display_name;
$authoremail = $authorinfo->user_email;
$authorurl = $authorinfo->user_url;

$receipients = get_option('admin_email');
$subject = "[".$blogtitle."] Please publish: \"".$posttitle."\" by ".$authorname;
$message = "A new post is ".$poststatus." for you to approve and publish.\n";
$message .= $editposturl."\n\n";
$message .= "Author: ".$authorname."\n";
$message .= "Email: ".$authoremail."\n";
$message .= "URL: ".$authorurl."\n\n";
$message .= "TITLE: ".$posttitle."\n\n";
$message .= "CONTENTS:\n\n".$postcontent;
$message_stripped = strip_tags($message);

wp_mail($receipients, $subject, $message_stripped);
}

add_action('draft_to_pending', 'fayid_emailpendingposts');

?>

To-do (need-based and time permitting)

  • Implement a Settings Page to enable users to specify notification email addresses

Tags: , ,


The Converstation: 6 Comments

  1. Email Pending Posts – Wordpress Plugin » Fayid.com | bllogger:

    [...] here to see the original: Email Pending Posts – Wordpress Plugin » Fayid.com internet [...]

  2. Email Pending Posts – Wordpress Plugin » Fayid.com | Hot WP Themes:

    [...] the original post here: Email Pending Posts – Wordpress Plugin » Fayid.com Related Posts:Plugin Updates Email Notifier PluginPlugins 023 – Interview Mitcho author of Yet [...]

  3. 12 Best WordPress SEO Plugins | Benzing Technologies | Creative Web Design, Affordable Web Hosting, SEO, Social Media Marketing:

    [...] Email Pending Posts – Wordpress Plugin » Fayid.com [...]

  4. Porush jain:

    I installed its throws up the error
    Incompatible archive PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

    I am running my website on wp 2.8.4

    [Reply to this Comment]

  5. Fayid:

    @ Porush jain … Sorry for the late reply – just haven’t had the time lately. Thanks for highlighting the problem. However, I’m able to unzip it and use it smoothly without any problems.

    So I’ve published the code in the post above, for you and for those who are having the PCLZIP_ERR_BAD_FORMAT (-10) error.

    Copy and paste the code in an editor and save as “emailpendingposts_ver0-2.php” … then upload / save it to the “…/wp-content/plugins/” directory. Hope this helps for now.

    I haven’t had the time to look into the problem in detail but there is some talk of it here:
    http://wordpress.org/support/topic/278487
    (not particularly related to this plugin though).

    [Reply to this Comment]

  6. Fayid:

    Tested with Wordpress ver 2.9. Work’s fine for me.

    [Reply to this Comment]

Say Something