Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.22   Updated Wednesday, July 1st, 2009 at 8:20pm

Draft Notification Plugin for WordPress

This WordPress plugin automatically emails the admin when a new draft is saved. The email contains the post’s title, the author, and a link. There is no options page currently, because there is really nothing to configure. The plugin now supports the new ‘pending’ status.

Download

  If you have found this page useful, please consider donating. Thanks!

Instructions

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory.
  • Enable the plugin.

Change Log

  • 07-01-09 Version 1.22 – You can now choose to send the emails to all users on or above a certain level (eg: editors).
  • 04-27-08 Version 1.21 – Updated to work with WordPress 2.5 and the ‘pending’ status.
  • 05-16-07 Version 1.2 – Updated to work with WordPress 2.2.
  • 10-20-06 Version 1.1 – The emails now contain the author’s name, instead of ID.
  • 04-22-06 Version 1.0 – First release.

Notes

Because of the way this plugin works, it also sends out an email when an existing draft has been saved again – This includes auto-saves. A solution to this is being researched.

By default, the author’s display_name is shown in the email. If you would prefer to see the login_name, or nice_name field, just look for the line in the script that says “Choose one of the following options to show the author’s name” and uncomment the option you would like to use.

Changing the user level for notifications

In the script, look for this line:

$email_user_level = 7;

This tells the script to send notification emails to anyone on, or above, that user level. Just change this for your particular needs.

Pages: « 4 3 [2] 1 » Show All

  1. I have installed the above plug in; how do I enable it?
    Thansk

  2. tyson: That should work fine, except you do not want that ‘echo’ there.

  3. 28
    tyson

    How could the $recipient line be changed so that one (or more ) static e-mail addresses could be entered? Something like this?

    $recipient = echo "jon@mail.com, mary@mail.com";

  4. Manne: I just added some alternate code you can try.

  5. 26
    Manne

    Unfortunately the author mod didn’t work for me…

  6. 25
    Manne

    Many thanks, I will try it out right away

  7. Manne: I just added instructions in the ‘Other Modifications’ section above. Let me know if it works for you.

  8. 23
    Manne

    Hello, and many thanks for a great plugin.

    I’m trying to figure out how to change it to email the author instead of the admin, any ideas?

  9. Josh: Very nice method :)

  10. I have added just a little bit of code to this to make it just a little better. With this code you can have the draft set to a time instead of every save. For example it will email you when the first draft is saved then the next time that the draft is saved it will only email you it is past your time set, I have at 10 minutes.

    Here is the code:

    
    //Original code
    $recipient = get_bloginfo('admin_email');
    
    // New code
    if ( isset($_COOKIE['draft_page_id_'.$id])  )
    {
    	//there is a cookie for this draft under the set time 
    	$minDelay = 10;// this is how many minutes to delay before a resend
    	if( ($_COOKIE['draft_page_id_'.$id]+(60*$minDelay) ) < time() )
    	{
    		//set the cookie for the current Draft
    		setcookie('draft_page_id_'.$id, time(), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
    		mail($recipient, "Saved Draft".$subject, $message);
    	}
    }
    else
    {
    	//set the cookie for the first Draft
    	setcookie('draft_page_id_'.$id, time(), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
    	//now send email
    	mail($recipient, "Starting Draft".$subject, $message);
    }
    
    

  11. Next time I have a chance, I will see if there is anyway to do it :)

  12. I agree with Scot’s comment (#19), especially with the auto-save feature in WordPress 2.1. If the contributor were able to select to send a draft notification, that would be great (plus, I can be sure that I’m reviewing their final best efforts!). Otherwise, I love the plugin!

  13. Rather than sending automatically upon save (or auto-save), would love to see a checkbox option in the editor to send notification. Also, I agree that it should be possible to customize the destination email (in my case I’d want it to be sent to a mailing list address for editors). And I agree that the link in the email should go to the back-end, not to a public page.

  14. Teeth: I know that WordPress 2.1 has implemented several new hooks. I will have to look through them to see if there is a way to detect the difference.

  15. Great plugin, but with the Wordpress 2.1 it gets a little annoying as a message is sent everytime the system does an autosave. I hope there is a way around to having the message delivered ONLY when the save draft is pressed, I wonder how but just an idea

Pages: « 4 3 [2] 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.