Ticket #6286: 6286.diff
File 6286.diff, 2.5 KB (added by , 15 years ago) |
---|
-
wp-includes/pluggable.php
1005 1005 $moderating_user = wp_get_current_user(); 1006 1006 $moderating_uid = (int) $user->id; 1007 1007 1008 if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author. 1008 1009 1009 if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author.1010 1011 1010 if ( $user->user_id == $moderating_uid ) return false; // The author moderated a comment on his own post 1012 1011 1013 1012 if ('' == $user->user_email) return false; // If there's no email to send the comment to … … 1099 1098 function wp_notify_moderator($comment_id) { 1100 1099 global $wpdb; 1101 1100 1102 if ( get_option( "moderation_notify" ) == 0)1101 if ( 0 == get_option( 'moderation_notify' ) ) 1103 1102 return true; 1104 1103 1105 $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID=%d LIMIT 1", $comment_id)); 1106 $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID=%d LIMIT 1", $comment->comment_post_ID)); 1104 $comment = get_comment($comment_id); 1105 $post = get_post($comment->comment_post_ID); 1106 $user = get_userdata( $post->post_author ); 1107 // Send to the administation and to the post author if the author can modify the comment. 1108 $email_to = array( get_option('admin_email') ); 1109 if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) ) 1110 $email_to[] = $user->user_email; 1107 1111 1108 1112 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 1109 1113 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); … … 1151 1155 $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n"; 1152 1156 1153 1157 $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title ); 1154 $admin_email = get_option('admin_email');1155 1158 $message_headers = ''; 1156 1159 1157 1160 $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); 1158 1161 $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); 1159 1162 $message_headers = apply_filters('comment_moderation_headers', $message_headers); 1160 1163 1161 @wp_mail($admin_email, $subject, $notify_message, $message_headers); 1164 foreach ( $email_to as $email ) 1165 @wp_mail($email, $subject, $notify_message, $message_headers); 1162 1166 1163 1167 return true; 1164 1168 }