Send comment approval notification to post author via hook.
This is part of the project of #33587. Moving this particular message to the 'wp_set_comment_status' action has the added bonus that the notification is sent after the comment status has been updated in the database. Previously, a database error could lead to a case where an approval notification is sent, but the comment status change fails for some reason. Props mrmist, NickDuncan. Fixes #14078. git-svn-id: https://develop.svn.wordpress.org/trunk@34537 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
93d781343a
commit
3714a915a2
@ -1770,9 +1770,7 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false)
|
||||
case 'approve':
|
||||
case '1':
|
||||
$status = '1';
|
||||
if ( get_option('comments_notify') ) {
|
||||
wp_notify_postauthor( $comment_id );
|
||||
}
|
||||
add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );
|
||||
break;
|
||||
case 'spam':
|
||||
$status = 'spam';
|
||||
|
Loading…
Reference in New Issue
Block a user