Make WordPress Core


Ignore:
Timestamp:
07/30/2009 01:39:34 PM (15 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/comment.php

    r11731 r11749  
    4545        comment_footer_die( __('You are not allowed to edit comments on this post.') );
    4646
    47     if ( 'deleted' == $comment->comment_status )
    48         comment_footer_die( __('This comment has been deleted. Please move it out of the Trash if you want to edit it.') );
     47    if ( 'trash' == $comment->comment_status )
     48        comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
    4949   
    5050    $comment = get_comment_to_edit( $comment_id );
     
    167167    break;
    168168
     169case 'trashcomment' :
     170case 'untrashcomment' :
     171    $comment_id = absint( $_REQUEST['c'] );
     172    $noredir = isset($_REQUEST['noredir']);
     173   
     174    if (!$comment = get_comment($comment_id))
     175        comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
     176    if (!current_user_can('edit_post', $comment->comment_post_ID ))
     177        comment_footer_die( __('You are not allowed to edit comments on this post.') );
     178   
     179    if ($action == 'trashcomment') {
     180        check_admin_referer( 'trash-comment_' . $comment_id );
     181        wp_trash_comment($comment_id);
     182    }
     183    else {
     184        check_admin_referer( 'untrash-comment_' . $comment_id );
     185        wp_untrash_comment($comment_id);
     186    }
     187   
     188    if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
     189        wp_redirect( wp_get_referer() );
     190    else if ('' != wp_get_original_referer() && false == $noredir)
     191        wp_redirect(wp_get_original_referer());
     192    else
     193        wp_redirect(admin_url('edit-comments.php'));
     194
     195    die;
     196    break;
     197
    169198case 'unapprovecomment' :
    170199    $comment_id = absint( $_GET['c'] );
Note: See TracChangeset for help on using the changeset viewer.