Improve consistency of comment notification callback signatures.

Both `wp_new_comment_notify_moderator()` and `wp_new_comment_notify_postauthor()`
now accept a single argument: `$comment_ID`.

Props SergeyBiryukov.
Fixes #33587.

git-svn-id: https://develop.svn.wordpress.org/trunk@34252 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-09-16 22:25:07 +00:00
parent de7c9b6015
commit 03ec7cc107
2 changed files with 6 additions and 5 deletions

View File

@ -1646,13 +1646,14 @@ function wp_new_comment( $commentdata ) {
*
* @since 4.4.0
*
* @param int $comment_ID ID of the comment.
* @param int $comment_approved Whether the comment is approved.
* @param int $comment_ID ID of the comment.
* @return bool True on success, false on failure.
*/
function wp_new_comment_notify_moderator( $comment_ID, $comment_approved ) {
function wp_new_comment_notify_moderator( $comment_ID ) {
$comment = get_comment( $comment_ID );
// Only send notifications for pending comments.
if ( '0' != $comment_approved ) {
if ( '0' != $comment->comment_approved ) {
return false;
}

View File

@ -336,7 +336,7 @@ add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 );
add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' );
// Email notifications.
add_action( 'comment_post', 'wp_new_comment_notify_moderator', 10, 2 );
add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
add_action( 'after_password_reset', 'wp_password_change_notification' );
add_action( 'register_new_user', 'wp_send_new_user_notifications' );