From 0e3f9e6b8d3af682a03d018e01ca3a537a9326e5 Mon Sep 17 00:00:00 2001 From: ryan 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: http://svn.automattic.com/wordpress/trunk@11860 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 98d55dc9a..390efc018 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);