WordPress.org

Make WordPress Core

Ticket #12774: 12774.diff

File 12774.diff, 2.0 KB (added by nacin, 3 years ago)
  • wp-includes/pluggable.php

     
    998998 * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback' 
    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; 
     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 ); 
    10071005 
     1006        // The comment was left by the author 
     1007        if ( $comment->user_id == $post->post_author ) 
     1008                return false; 
    10081009 
    1009         if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author. 
    1010         
    1011         if ( $user->user_id == $moderating_uid ) return false; // The author moderated a comment on his own post 
     1010        // The author moderated a comment on his own post 
     1011        if ( $post->post_author == get_current_user_id() ) 
     1012                return false; 
    10121013 
    1013         if ('' == $user->user_email) return false; // If there's no email to send the comment to 
     1014        // If there's no email to send the comment to 
     1015        if ( '' == $author->user_email ) 
     1016                return false; 
    10141017 
    10151018        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 
    10161019 
     
    10801083        $subject = apply_filters('comment_notification_subject', $subject, $comment_id); 
    10811084        $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); 
    10821085 
    1083         @wp_mail($user->user_email, $subject, $notify_message, $message_headers); 
     1086        @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); 
    10841087 
    10851088        return true; 
    10861089}