Trash status updates for posts, pages, comments and attachments, props caesarsgrunt, see #4529

git-svn-id: https://develop.svn.wordpress.org/trunk@11749 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2009-07-30 13:39:34 +00:00
parent dfa42e3952
commit d9f8c67f2f
29 changed files with 758 additions and 329 deletions

View File

@@ -44,8 +44,8 @@ case 'editcomment' :
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
comment_footer_die( __('You are not allowed to edit comments on this post.') );
if ( 'deleted' == $comment->comment_status )
comment_footer_die( __('This comment has been deleted. Please move it out of the Trash if you want to edit it.') );
if ( 'trash' == $comment->comment_status )
comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
$comment = get_comment_to_edit( $comment_id );
@@ -166,6 +166,35 @@ case 'deletecomment' :
die;
break;
case 'trashcomment' :
case 'untrashcomment' :
$comment_id = absint( $_REQUEST['c'] );
$noredir = isset($_REQUEST['noredir']);
if (!$comment = get_comment($comment_id))
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
if (!current_user_can('edit_post', $comment->comment_post_ID ))
comment_footer_die( __('You are not allowed to edit comments on this post.') );
if ($action == 'trashcomment') {
check_admin_referer( 'trash-comment_' . $comment_id );
wp_trash_comment($comment_id);
}
else {
check_admin_referer( 'untrash-comment_' . $comment_id );
wp_untrash_comment($comment_id);
}
if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
wp_redirect( wp_get_referer() );
else if ('' != wp_get_original_referer() && false == $noredir)
wp_redirect(wp_get_original_referer());
else
wp_redirect(admin_url('edit-comments.php'));
die;
break;
case 'unapprovecomment' :
$comment_id = absint( $_GET['c'] );
check_admin_referer( 'unapprove-comment_' . $comment_id );