WordPress.org

Make WordPress Core

Ticket #12774: dont_notify_author.patch

File dont_notify_author.patch, 941 bytes (added by mrmist, 4 years ago)

Don't notify the author when he moderated the comment

  • wp-includes/pluggable.php

     
    10041004        $comment = get_comment($comment_id); 
    10051005        $post    = get_post($comment->comment_post_ID); 
    10061006        $user    = get_userdata( $post->post_author ); 
     1007        $moderating_user = wp_get_current_user(); 
     1008        $moderating_uid = (int) $user->id; 
    10071009 
    1008         if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post 
    10091010 
     1011        if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author. 
     1012        
     1013        if ( $user->user_id == $moderating_uid ) return false;// The author moderated a comment on his own post 
     1014 
    10101015        if ('' == $user->user_email) return false; // If there's no email to send the comment to 
    10111016 
    10121017        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);