Don't notify your own comments, fixes #1670
git-svn-id: http://svn.automattic.com/wordpress/trunk@3031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
833f1cca4e
commit
f67be7f30f
|
@ -34,11 +34,15 @@ function wp_new_comment( $commentdata ) {
|
||||||
$commentdata = apply_filters('preprocess_comment', $commentdata);
|
$commentdata = apply_filters('preprocess_comment', $commentdata);
|
||||||
|
|
||||||
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
||||||
|
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
||||||
|
|
||||||
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
|
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
|
||||||
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
$commentdata['comment_date'] = current_time('mysql');
|
$commentdata['comment_date'] = current_time('mysql');
|
||||||
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
|
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
|
||||||
|
|
||||||
|
|
||||||
$commentdata = wp_filter_comment($commentdata);
|
$commentdata = wp_filter_comment($commentdata);
|
||||||
|
|
||||||
$commentdata['comment_approved'] = wp_allow_comment($commentdata);
|
$commentdata['comment_approved'] = wp_allow_comment($commentdata);
|
||||||
|
@ -51,7 +55,9 @@ function wp_new_comment( $commentdata ) {
|
||||||
if ( '0' == $commentdata['comment_approved'] )
|
if ( '0' == $commentdata['comment_approved'] )
|
||||||
wp_notify_moderator($comment_ID);
|
wp_notify_moderator($comment_ID);
|
||||||
|
|
||||||
if ( get_settings('comments_notify') && $commentdata['comment_approved'] )
|
$post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
|
||||||
|
|
||||||
|
if ( get_settings('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
|
||||||
wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
|
wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue