Comments shouldn't have more than one _wp_trash_meta_status entry. When deleting _wp_trash_meta_status, also delete _wp_trash_meta_time.

See #11200.

Built from https://develop.svn.wordpress.org/trunk@33654


git-svn-id: http://core.svn.wordpress.org/trunk@33621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-08-20 02:45:26 +00:00
parent 7c0d3ab83a
commit 572a0a587a
2 changed files with 11 additions and 5 deletions

View File

@ -1857,8 +1857,10 @@ function wp_trash_comment($comment_id) {
do_action( 'trash_comment', $comment_id ); do_action( 'trash_comment', $comment_id );
if ( wp_set_comment_status($comment_id, 'trash') ) { if ( wp_set_comment_status($comment_id, 'trash') ) {
add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved); delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
add_comment_meta($comment_id, '_wp_trash_meta_time', time() ); delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
add_comment_meta( $comment_id, '_wp_trash_meta_status', $comment->comment_approved );
add_comment_meta( $comment_id, '_wp_trash_meta_time', time() );
/** /**
* Fires immediately after a comment is sent to Trash. * Fires immediately after a comment is sent to Trash.
@ -1938,7 +1940,10 @@ function wp_spam_comment($comment_id) {
do_action( 'spam_comment', $comment_id ); do_action( 'spam_comment', $comment_id );
if ( wp_set_comment_status($comment_id, 'spam') ) { if ( wp_set_comment_status($comment_id, 'spam') ) {
add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved); delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
add_comment_meta( $comment_id, '_wp_trash_meta_status', $comment->comment_approved );
add_comment_meta( $comment_id, '_wp_trash_meta_time', time() );
/** /**
* Fires immediately after a comment is marked as Spam. * Fires immediately after a comment is marked as Spam.
* *
@ -1979,7 +1984,8 @@ function wp_unspam_comment($comment_id) {
$status = '0'; $status = '0';
if ( wp_set_comment_status($comment_id, $status) ) { if ( wp_set_comment_status($comment_id, $status) ) {
delete_comment_meta($comment_id, '_wp_trash_meta_status'); delete_comment_meta( $comment_id, '_wp_trash_meta_status' );
delete_comment_meta( $comment_id, '_wp_trash_meta_time' );
/** /**
* Fires immediately after a comment is unmarked as Spam. * Fires immediately after a comment is unmarked as Spam.
* *

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33653'; $wp_version = '4.4-alpha-33654';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.