From 48b7547a52e29141a53bb2ed37e40125eabe154b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 16 Sep 2015 22:26:24 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34252 git-svn-id: http://core.svn.wordpress.org/trunk@34216 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 9 +++++---- wp-includes/default-filters.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 2de0322865..155e7b4da0 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -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; } diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 4081be43c1..f9fd9c47c9 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -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' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 4aa448715f..a127fece0a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34251'; +$wp_version = '4.4-alpha-34252'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.