From f296da81697841fe727d7e6477ca17ed4abb4238 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sat, 28 Nov 2009 03:56:20 +0000 Subject: [PATCH] "Trash" fixes, props caesarsgrunt, see #4529 git-svn-id: http://svn.automattic.com/wordpress/trunk@12290 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/upload.php | 2 +- wp-includes/comment.php | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 8853bb715..768714074 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -206,7 +206,7 @@ if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) { $messages[1] = __('Media attachment updated.'); $messages[2] = __('Media permanently deleted.'); $messages[3] = __('Error saving media attachment.'); -$messages[4] = __('Media moved to the trash.') . ' ' . __('Undo?') . ''; +$messages[4] = __('Media moved to the trash.') . ' ' . __('Undo?') . ''; $messages[5] = __('Media restored from the trash.'); if ( isset($_GET['message']) && (int) $_GET['message'] ) { diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 5add482c3..a32981ea4 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -892,15 +892,11 @@ function wp_untrash_comment($comment_id) { do_action('untrash_comment', $comment_id); - $comment = array('comment_ID' => $comment_id); - - $status = get_comment_meta($comment_id, '_wp_trash_meta_status', true); + $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); if ( empty($status) ) $status = '0'; - $comment['comment_approved'] = $status; - - if ( wp_update_comment($comment) ) { + if ( wp_set_comment_status($comment_id, $status) ) { delete_comment_meta($comment_id, '_wp_trash_meta_time'); delete_comment_meta($comment_id, '_wp_trash_meta_status'); do_action('untrashed_comment', $comment_id); @@ -951,11 +947,11 @@ function wp_unspam_comment($comment_id) { do_action('unspam_comment', $comment_id); - $status = get_comment_meta($comment_id, '_wp_trash_meta_status', true); + $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); if ( empty($status) ) $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'); do_action('unspammed_comment', $comment_id); return true;