WordPress.org

Make WordPress Core

Changeset 9183


Ignore:
Timestamp:
10/15/2008 10:31:39 AM (10 years ago)
Author:
azaozz
Message:

Don't delete spam created after page has loaded but before "Delete All" button pressed, props Viper007Bond, see #7552

File:
1 edited

Legend:

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

    r9122 r9183  
    1515wp_enqueue_script( 'jquery-table-hotkeys' );
    1616
    17 if ( isset( $_POST['delete_all_spam'] ) || isset( $_POST['delete_all_spam2'] ) ) {
     17if ( ( isset( $_POST['delete_all_spam'] ) || isset( $_POST['delete_all_spam2'] ) ) && !empty( $_POST['pagegen_timestamp'] ) ) {
    1818    check_admin_referer('bulk-spam-delete');
    1919
    20     $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'" );
     20    $formtime = (int) $_POST['pagegen_timestamp'];
     21
     22    $deleted_spam = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_date_gmt < FROM_UNIXTIME(%d)", $formtime ) );
    2123    wp_redirect('edit-comments.php?deleted=' . (int) $deleted_spam);
    2224}
     
    209211<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
    210212<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
     213<input type="hidden" name="pagegen_timestamp" value="<?php echo current_time( 'timestamp', TRUE ); ?>" />
    211214
    212215<div class="tablenav">
Note: See TracChangeset for help on using the changeset viewer.