Make WordPress Core

Changeset 8851


Ignore:
Timestamp:
09/08/2008 09:49:26 PM (16 years ago)
Author:
azaozz
Message:

Adds "Delete all spam" button when viewing spam in comment management

File:
1 edited

Legend:

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

    r8839 r8851  
    1414wp_enqueue_script( 'admin-forms' );
    1515wp_enqueue_script( 'jquery-table-hotkeys' );
     16
     17if ( isset( $_POST['delete_all_spam'] ) ) {
     18    check_admin_referer('bulk-spam-delete');
     19   
     20    $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'" );
     21    wp_redirect('edit-comments.php?deleted=' . (int) $deleted_spam);
     22}
    1623
    1724if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
     
    6269$search = attribute_escape( $search_dirty );
    6370?>
     71
    6472<?php
    6573if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
     
    110118    if ( $status == $comment_status )
    111119        $class = ' class="current"';
    112 
    113120
    114121    $status_links[] = "<li class='$status'><a href=\"edit-comments.php?comment_status=$status\"$class>$label</a>";
     
    187194<option value="delete"><?php _e('Delete'); ?></option>
    188195</select>
    189 <input type="submit" name="doaction" value="Apply" class="button-secondary apply" />
     196<input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
    190197<?php do_action('manage_comments_nav', $comment_status); ?>
    191198<?php wp_nonce_field('bulk-comments'); ?>
    192199<?php if ( isset($_GET['apage']) ) { ?>
    193200    <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
     201<?php }
     202
     203if ( 'spam' == $comment_status ) {
     204    wp_nonce_field('bulk-spam-delete'); ?>
     205<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
    194206<?php } ?>
    195207</div>
Note: See TracChangeset for help on using the changeset viewer.