From 9c66e66ac50a2dfd063456ed8480e29d8ef5fec0 Mon Sep 17 00:00:00 2001 From: "Drew Jaynes (DrewAPicture)" Date: Fri, 25 Apr 2014 06:54:33 +0000 Subject: [PATCH] Ensure the `wp_set_comment_status` action hook is only documented once. See #26869. git-svn-id: https://develop.svn.wordpress.org/trunk@28214 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index f7ddbc478f..52879ebbe5 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -1187,15 +1187,9 @@ function wp_delete_comment($comment_id, $force_delete = false) { clean_comment_cache($comment_id); - /** - * Fires immediately before changing the comment's status to 'delete'. - * - * @since 1.5.0 - * - * @param int $comment_id The comment ID. - * @param string $status The new 'delete' comment status. - */ + /** This action is documented in wp-includes/comment.php */ do_action( 'wp_set_comment_status', $comment_id, 'delete' ); + wp_transition_comment_status('delete', $comment->comment_approved, $comment); return true; } @@ -1777,17 +1771,17 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) $comment = get_comment($comment_id); /** - * Fires after a comment status has been updated in the database. - * - * The hook also fires immediately before comment status transition hooks are fired. + * Fires immediately before transitioning a comment's status from one to another + * in the database. * * @since 1.5.0 * - * @param int $comment_id The comment ID. - * @param string|bool $comment_status The comment status. Possible values include 'hold', - * 'approve', 'spam', 'trash', or false. + * @param int $comment_id Comment ID. + * @param string|bool $comment_status Current comment status. Possible values include + * 'hold', 'approve', 'spam', 'trash', or false. */ do_action( 'wp_set_comment_status', $comment_id, $comment_status ); + wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment); wp_update_comment_count($comment->comment_post_ID);