Ticket #16995: 16995.2.diff

File 16995.2.diff, 5.7 KB (added by solarissmoke, 2 years ago)

All nicely spaced :)

  • wp-includes/comment.php

     
    13391339 
    13401340        if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching 
    13411341                if ( '0' == $commentdata['comment_approved'] ) 
    1342                         wp_notify_moderator($comment_ID); 
    1343  
    1344                 $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment 
    1345  
    1346                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) 
    1347                         wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); 
     1342                        wp_notify_moderator( $comment_ID ); 
     1343                else 
     1344                        wp_notify_postauthor( $comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); 
    13481345        } 
    13491346 
    13501347        return $comment_ID; 
     
    13791376                case 'approve': 
    13801377                case '1': 
    13811378                        $status = '1'; 
    1382                         if ( get_option('comments_notify') ) { 
    1383                                 $comment = get_comment($comment_id); 
    1384                                 wp_notify_postauthor($comment_id, $comment->comment_type); 
    1385                         } 
     1379                        $comment = get_comment( $comment_id ); 
     1380                        wp_notify_postauthor( $comment_id, $comment->comment_type ); 
    13861381                        break; 
    13871382                case 'spam': 
    13881383                        $status = 'spam'; 
  • wp-includes/pluggable.php

     
    10041004 * 
    10051005 * @param int $comment_id Comment ID 
    10061006 * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback' 
    1007  * @return bool False if user email does not exist. True on completion. 
     1007 * @return bool False if mail was not sent. True on completion. 
    10081008 */ 
    10091009function wp_notify_postauthor( $comment_id, $comment_type = '' ) { 
     1010        if ( 0 == get_option( 'comments_notify' ) ) 
     1011                return false; 
     1012 
    10101013        $comment = get_comment( $comment_id ); 
    10111014        $post    = get_post( $comment->comment_post_ID ); 
    10121015        $author  = get_userdata( $post->post_author ); 
     
    10231026        if ( '' == $author->user_email ) 
    10241027                return false; 
    10251028 
    1026         $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 
     1029        $comment_author_domain = @gethostbyaddr( $comment->comment_author_IP ); 
    10271030 
    10281031        // The blogname option is escaped with esc_html on the way into the database in sanitize_option 
    10291032        // we want to reverse this for the plain text arena of emails. 
    1030         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 
     1033        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 
    10311034 
    10321035        if ( empty( $comment_type ) ) $comment_type = 'comment'; 
    10331036 
    1034         if ('comment' == $comment_type) { 
     1037        if ( 'comment' == $comment_type ) { 
    10351038                $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; 
    10361039                /* translators: 1: comment author, 2: author IP, 3: author domain */ 
    10371040                $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 
     
    10421045                $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; 
    10431046                /* translators: 1: blog name, 2: post title */ 
    10441047                $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); 
    1045         } elseif ('trackback' == $comment_type) { 
     1048        } elseif ( 'trackback' == $comment_type ) { 
    10461049                $notify_message  = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; 
    10471050                /* translators: 1: website name, 2: author IP, 3: author domain */ 
    10481051                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 
     
    10511054                $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; 
    10521055                /* translators: 1: blog name, 2: post title */ 
    10531056                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); 
    1054         } elseif ('pingback' == $comment_type) { 
     1057        } elseif ( 'pingback' == $comment_type ) { 
    10551058                $notify_message  = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; 
    10561059                /* translators: 1: comment author, 2: author IP, 3: author domain */ 
    10571060                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 
     
    10611064                /* translators: 1: blog name, 2: post title */ 
    10621065                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); 
    10631066        } 
    1064         $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
     1067        $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n"; 
    10651068        $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; 
    10661069        if ( EMPTY_TRASH_DAYS ) 
    10671070                $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; 
     
    10871090        if ( isset($reply_to) ) 
    10881091                $message_headers .= $reply_to . "\n"; 
    10891092 
    1090         $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id); 
    1091         $subject = apply_filters('comment_notification_subject', $subject, $comment_id); 
    1092         $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); 
     1093        $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id ); 
     1094        $subject = apply_filters( 'comment_notification_subject', $subject, $comment_id ); 
     1095        $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id ); 
    10931096 
    10941097        @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); 
    10951098