From 3e35ee1c6a914dc9bb43b3c8d0ad34b302f9dd73 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 21 Aug 2009 01:27:01 +0000 Subject: [PATCH] Pass correct old status when transitioning comment status. Props hakre. fixes #8863 git-svn-id: https://develop.svn.wordpress.org/trunk@11860 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 98d55dc9aa..390efc018b 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1116,6 +1116,8 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) return false; } + $comment_old = get_comment($comment_id); + if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { if ( $wp_error ) return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error); @@ -1128,7 +1130,7 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) $comment = get_comment($comment_id); do_action('wp_set_comment_status', $comment_id, $comment_status); - wp_transition_comment_status($comment_status, $comment->comment_approved, $comment); + wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment); wp_update_comment_count($comment->comment_post_ID);