"Trash" fixes, props caesarsgrunt, see #4529

git-svn-id: http://svn.automattic.com/wordpress/trunk@12290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-11-28 03:56:20 +00:00
parent 00a9b90dc9
commit f296da8169
2 changed files with 5 additions and 9 deletions

View File

@ -206,7 +206,7 @@ if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
$messages[1] = __('Media attachment updated.'); $messages[1] = __('Media attachment updated.');
$messages[2] = __('Media permanently deleted.'); $messages[2] = __('Media permanently deleted.');
$messages[3] = __('Error saving media attachment.'); $messages[3] = __('Error saving media attachment.');
$messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.$_GET['ids'], "bulk-media" ) ) . '">' . __('Undo?') . '</a>'; $messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo?') . '</a>';
$messages[5] = __('Media restored from the trash.'); $messages[5] = __('Media restored from the trash.');
if ( isset($_GET['message']) && (int) $_GET['message'] ) { if ( isset($_GET['message']) && (int) $_GET['message'] ) {

View File

@ -892,15 +892,11 @@ function wp_untrash_comment($comment_id) {
do_action('untrash_comment', $comment_id); do_action('untrash_comment', $comment_id);
$comment = array('comment_ID' => $comment_id); $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);
$status = get_comment_meta($comment_id, '_wp_trash_meta_status', true);
if ( empty($status) ) if ( empty($status) )
$status = '0'; $status = '0';
$comment['comment_approved'] = $status; if ( wp_set_comment_status($comment_id, $status) ) {
if ( wp_update_comment($comment) ) {
delete_comment_meta($comment_id, '_wp_trash_meta_time'); delete_comment_meta($comment_id, '_wp_trash_meta_time');
delete_comment_meta($comment_id, '_wp_trash_meta_status'); delete_comment_meta($comment_id, '_wp_trash_meta_status');
do_action('untrashed_comment', $comment_id); do_action('untrashed_comment', $comment_id);
@ -951,11 +947,11 @@ function wp_unspam_comment($comment_id) {
do_action('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) ) if ( empty($status) )
$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');
do_action('unspammed_comment', $comment_id); do_action('unspammed_comment', $comment_id);
return true; return true;