Ticket #761: 761.3.diff
| File 761.3.diff, 2.6 KB (added by coffee2code, 8 months ago) |
|---|
-
wp-includes/comment.php
1332 1332 * 1333 1333 * @since 1.5.0 1334 1334 * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing 1335 * @uses apply_filters() Calls 'wp_notify_post_author' hook on initial evaluation about if post author should be notified and comment ID. 1335 1336 * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved. 1336 1337 * @uses wp_filter_comment() Used to filter comment before adding comment. 1337 1338 * @uses wp_allow_comment() checks to see if comment is approved. … … 1373 1374 1374 1375 $post = get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment 1375 1376 1376 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) 1377 $maybe_notify = get_option( 'comments_notify' ) && $commentdata['comment_approved']; 1378 if ( isset( $commentdata['user_id'] ) && $post->post_author == $commentdata['user_id'] ) 1379 $maybe_notify = false; 1380 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_ID ); 1381 1382 if ( $maybe_notify ) 1377 1383 wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); 1378 1384 } 1379 1385 … … 1388 1394 * 1389 1395 * @since 1.0.0 1390 1396 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object 1397 * @uses apply_filters() Calls 'wp_notify_post_author' hook on initial evaluation about if post author should be notified and comment ID. 1391 1398 * 1392 1399 * @param int $comment_id Comment ID. 1393 1400 * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'. … … 1406 1413 case 'approve': 1407 1414 case '1': 1408 1415 $status = '1'; 1409 if ( get_option('comments_notify') ) {1410 $comment = get_comment($comment_id);1411 wp_notify_postauthor($comment_id, $comment->comment_type);1412 }1413 1416 break; 1414 1417 case 'spam': 1415 1418 $status = 'spam'; … … 1434 1437 1435 1438 $comment = get_comment($comment_id); 1436 1439 1440 $maybe_notify = get_option( 'comments_notify' ) && '1' == $status; 1441 $maybe_notify = apply_filters( 'wp_notify_post_author', $maybe_notify, $comment_id ); 1442 if ( $maybe_notify ) 1443 wp_notify_postauthor( $comment_id, $comment->comment_type ); 1444 1437 1445 do_action('wp_set_comment_status', $comment_id, $comment_status); 1438 1446 wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment); 1439 1447
