WordPress.org

Make WordPress Core

Changeset 16304


Ignore:
Timestamp:
11/11/2010 04:28:49 PM (8 years ago)
Author:
nacin
Message:

Don't notify the author when they posted or moderated the comment. fixes #12774.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r16223 r16304  
    999999 * @return bool False if user email does not exist. True on completion.
    10001000 */
    1001 function wp_notify_postauthor($comment_id, $comment_type='') {
    1002     $comment = get_comment($comment_id);
    1003     $post    = get_post($comment->comment_post_ID);
    1004     $user    = get_userdata( $post->post_author );
    1005     $moderating_user = wp_get_current_user();
    1006     $moderating_uid = (int) $user->id;
    1007 
    1008     if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author.
    1009 
    1010     if ( $user->user_id == $moderating_uid ) return false; // The author moderated a comment on his own post
    1011 
    1012     if ('' == $user->user_email) return false; // If there's no email to send the comment to
     1001function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
     1002    $comment = get_comment( $comment_id );
     1003    $post    = get_post( $comment->comment_post_ID );
     1004    $author  = get_userdata( $post->post_author );
     1005
     1006    // The comment was left by the author
     1007    if ( $comment->user_id == $post->post_author )
     1008        return false;
     1009
     1010    // The author moderated a comment on his own post
     1011    if ( $post->post_author == get_current_user_id() )
     1012        return false;
     1013
     1014    // If there's no email to send the comment to
     1015    if ( '' == $author->user_email )
     1016        return false;
    10131017
    10141018    $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
     
    10801084    $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id);
    10811085
    1082     @wp_mail($user->user_email, $subject, $notify_message, $message_headers);
     1086    @wp_mail( $author->user_email, $subject, $notify_message, $message_headers );
    10831087
    10841088    return true;
Note: See TracChangeset for help on using the changeset viewer.