| 1 | Index: wp-includes/comment.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/comment.php (revision 18324) |
|---|
| 4 | +++ wp-includes/comment.php (working copy) |
|---|
| 5 | @@ -1352,10 +1352,13 @@ |
|---|
| 6 | if ( '0' == $commentdata['comment_approved'] ) |
|---|
| 7 | wp_notify_moderator($comment_ID); |
|---|
| 8 | |
|---|
| 9 | - $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment |
|---|
| 10 | + if ( get_option('comments_notify') && $commentdata['comment_approved'] ) { |
|---|
| 11 | + $post = get_post( $commentdata['comment_post_ID'] ); |
|---|
| 12 | |
|---|
| 13 | - if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) |
|---|
| 14 | - wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); |
|---|
| 15 | + // Don't notify if it's your own comment |
|---|
| 16 | + if ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) |
|---|
| 17 | + wp_notify_postauthor( $comment_ID ); |
|---|
| 18 | + } |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | return $comment_ID; |
|---|
| 22 | @@ -1391,8 +1394,7 @@ |
|---|
| 23 | case '1': |
|---|
| 24 | $status = '1'; |
|---|
| 25 | if ( get_option('comments_notify') ) { |
|---|
| 26 | - $comment = get_comment($comment_id); |
|---|
| 27 | - wp_notify_postauthor($comment_id, $comment->comment_type); |
|---|
| 28 | + wp_notify_postauthor( $comment_id ); |
|---|
| 29 | } |
|---|
| 30 | break; |
|---|
| 31 | case 'spam': |
|---|
| 32 | Index: wp-includes/pluggable.php |
|---|
| 33 | =================================================================== |
|---|
| 34 | --- wp-includes/pluggable.php (revision 18324) |
|---|
| 35 | +++ wp-includes/pluggable.php (working copy) |
|---|
| 36 | @@ -1040,10 +1040,13 @@ |
|---|
| 37 | * @since 1.0.0 |
|---|
| 38 | * |
|---|
| 39 | * @param int $comment_id Comment ID |
|---|
| 40 | - * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback' |
|---|
| 41 | + * @param string $deprecated Not used |
|---|
| 42 | * @return bool False if user email does not exist. True on completion. |
|---|
| 43 | */ |
|---|
| 44 | -function wp_notify_postauthor( $comment_id, $comment_type = '' ) { |
|---|
| 45 | +function wp_notify_postauthor( $comment_id, $deprecated = null ) { |
|---|
| 46 | + if ( null !== $deprecated ) |
|---|
| 47 | + _deprecated_argument( __FUNCTION__, '3.3' ); |
|---|
| 48 | + |
|---|
| 49 | $comment = get_comment( $comment_id ); |
|---|
| 50 | $post = get_post( $comment->comment_post_ID ); |
|---|
| 51 | $author = get_userdata( $post->post_author ); |
|---|
| 52 | @@ -1066,7 +1069,7 @@ |
|---|
| 53 | // we want to reverse this for the plain text arena of emails. |
|---|
| 54 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|---|
| 55 | |
|---|
| 56 | - if ( empty( $comment_type ) ) $comment_type = 'comment'; |
|---|
| 57 | + $comment_type = $comment->comment_type ? $comment->comment_type : 'comment'; |
|---|
| 58 | |
|---|
| 59 | if ('comment' == $comment_type) { |
|---|
| 60 | $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; |
|---|