"Trash" fixes, props caesarsgrunt, see #4529

git-svn-id: https://develop.svn.wordpress.org/trunk@12290 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2009-11-28 03:56:20 +00:00
parent ed11892e7f
commit 365fea47fc
2 changed files with 5 additions and 9 deletions

View File

@@ -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;