-case 'approvecomment' :
-case 'unapprovecomment' :
- $comment_id = absint( $_GET['c'] );
- check_admin_referer( 'approve-comment_' . $comment_id );
-
- $noredir = isset( $_GET['noredir'] );
-
- if ( !$comment = get_comment( $comment_id ) )
- comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') );
-
- if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
- if ( 'approvecomment' == $action )
- comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
- else
- comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
- }
-
- if ( '' != wp_get_referer() && false == $noredir )
- $redir = remove_query_arg( array('approved', 'unapproved'), wp_get_referer() );
- else
- $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
-
- if ( 'approvecomment' == $action ) {
- wp_set_comment_status( $comment_id, 'approve' );
- $redir = add_query_arg( array( 'approved' => 1 ), $redir );
- } else {
- wp_set_comment_status( $comment_id, 'hold' );
- $redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
- }
-
- wp_redirect( $redir );
-
- exit();
- break;
-