mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 10:44:26 +00:00
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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user