Support » Plugins and Hacks » Hacks » Author notification

Author notification

  • Hi , Is there a plugin that can notify a post author once they edit/modify their post.

    So basically once the user(author) logs in, and edits his/her post, i want to fire off an email, now ive found a script online but it doesnt seem to work, i have also added a a function (to functions.php) once the user role has been changed, but need one for post edits.

    Any plugins,code snippets or help will be appreciated

    Thanks Guys

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can hook into process of saving a post or page and then send an email to the author:

    add_action( 'save_post', 'notifyAuthorOnPostModification' );
    function notifyAuthorOnPostModification() {
      global $post;
      $author   = get_user_by( 'id', (int) $post->post_author );
      $to       = $author->data->user_email;
      $subject  = 'A post of yours has been modified';
      $message  = "Your Article '" . $post->post_title . "' (" . get_permalink( $post->ID ) . ') has been modified on ' . date( 'Y-m-d (H:i:s)', time() ); // Or something like that
      wp_mail( $to, $subject, $message );

    Thanks i will test this and revert. Appreciate it

    Hi Chris

    This code works 100% perfectly when editing the posts from the back-end – thank you!

    But to throw a spanner in the works now – we actually block the WordPress backend from the users and they modify their posts using the WP User Front-end plugin.

    When we update posts from the front-end, we still receive the notification emails, however because the “edit post” page itself was created by the site administrator, that is where the emails go – instead of the post author.

    Any idea how we could resolve this?

    I’m not exactly familiar with the WP Use Front-end plugin but from what I see, it offers it’s own hook for after saving a post.

    So instead of add_action( 'save_post', 'notifyAuthorOnPostModification' );
    you could test add_action( 'wpuf_add_post_after_insert', 'notifyAuthorOnPostModification' ); and see if this will do the trick.

    Hi Chris

    Unfortunately this didn’t seem to work – but since in order to edit a post you first need to be signed in, we simply grabbed the current logged in user’s details and fired off the mail to him/her. (We have locked it down so that only logged in users can edit/delete their own posts.

    Here is the code we used:

    function notifyAuthorOnPostModification() {

    global $post;

    $username = wp_get_current_user();
    $to = $username->data->user_email;
    $subject = ‘Subject lines goes here’;
    $user = $user_info->display_name;
    $message = ‘Message goes here’;

    wp_mail( $to, $subject, $message );

    Thanks for your assistance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author notification’ is closed to new replies.