Ticket #16995: 16995.2.diff
| File 16995.2.diff, 5.7 KB (added by solarissmoke, 2 years ago) |
|---|
-
wp-includes/comment.php
1339 1339 1340 1340 if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching 1341 1341 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'] : '' ); 1348 1345 } 1349 1346 1350 1347 return $comment_ID; … … 1379 1376 case 'approve': 1380 1377 case '1': 1381 1378 $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 ); 1386 1381 break; 1387 1382 case 'spam': 1388 1383 $status = 'spam'; -
wp-includes/pluggable.php
1004 1004 * 1005 1005 * @param int $comment_id Comment ID 1006 1006 * @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. 1008 1008 */ 1009 1009 function wp_notify_postauthor( $comment_id, $comment_type = '' ) { 1010 if ( 0 == get_option( 'comments_notify' ) ) 1011 return false; 1012 1010 1013 $comment = get_comment( $comment_id ); 1011 1014 $post = get_post( $comment->comment_post_ID ); 1012 1015 $author = get_userdata( $post->post_author ); … … 1023 1026 if ( '' == $author->user_email ) 1024 1027 return false; 1025 1028 1026 $comment_author_domain = @gethostbyaddr( $comment->comment_author_IP);1029 $comment_author_domain = @gethostbyaddr( $comment->comment_author_IP ); 1027 1030 1028 1031 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 1029 1032 // 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 ); 1031 1034 1032 1035 if ( empty( $comment_type ) ) $comment_type = 'comment'; 1033 1036 1034 if ( 'comment' == $comment_type) {1037 if ( 'comment' == $comment_type ) { 1035 1038 $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; 1036 1039 /* translators: 1: comment author, 2: author IP, 3: author domain */ 1037 1040 $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; … … 1042 1045 $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; 1043 1046 /* translators: 1: blog name, 2: post title */ 1044 1047 $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); 1045 } elseif ( 'trackback' == $comment_type) {1048 } elseif ( 'trackback' == $comment_type ) { 1046 1049 $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; 1047 1050 /* translators: 1: website name, 2: author IP, 3: author domain */ 1048 1051 $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; … … 1051 1054 $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; 1052 1055 /* translators: 1: blog name, 2: post title */ 1053 1056 $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); 1054 } elseif ( 'pingback' == $comment_type) {1057 } elseif ( 'pingback' == $comment_type ) { 1055 1058 $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; 1056 1059 /* translators: 1: comment author, 2: author IP, 3: author domain */ 1057 1060 $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; … … 1061 1064 /* translators: 1: blog name, 2: post title */ 1062 1065 $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); 1063 1066 } 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"; 1065 1068 $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; 1066 1069 if ( EMPTY_TRASH_DAYS ) 1067 1070 $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; … … 1087 1090 if ( isset($reply_to) ) 1088 1091 $message_headers .= $reply_to . "\n"; 1089 1092 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 ); 1093 1096 1094 1097 @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); 1095 1098
