Make WordPress Core


Ignore:
Timestamp:
10/08/2009 08:24:59 AM (16 years ago)
Author:
azaozz
Message:

Add Undo when moving comments to the trash, remove unneeded nonces, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r11952 r12008  
    2929        $comment_ids = $_REQUEST['delete_comments'];
    3030        $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
     31    } elseif ($_REQUEST['action'] == 'untrash' && isset($_REQUEST['ids'])) {
     32        $comment_ids = explode(',', $_REQUEST['ids']);
     33        $doaction = 'untrash';
    3134    } else wp_redirect($_SERVER['HTTP_REFERER']);
    3235
     
    6770    }
    6871
    69     $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted;
     72    $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted . '&ids=' . join(',', $comment_ids);
    7073    if ( $post_id )
    7174        $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
     
    129132        }
    130133        if ( $trashed > 0 ) {
    131             printf( _n( '%s comment moved to the trash', '%s comments moved to the trash', $trashed ), $trashed );
    132             echo ' <a href="' . admin_url('edit-comments.php?comment_status=trash') . '">' . __('View trash') . '</a><br />';
     134            printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed );
     135            $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
     136            echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo?') . '</a><br />';
    133137        }
    134138        if ( $untrashed > 0 ) {
     
    415419<?php
    416420wp_comment_reply('-1', true, 'detail');
     421wp_comment_trashnotice();
    417422include('admin-footer.php'); ?>
Note: See TracChangeset for help on using the changeset viewer.