WordPress.org

Make WordPress Core

Ticket #8684: trunk-edit-comments.diff

File trunk-edit-comments.diff, 1.4 KB (added by mrmist, 5 years ago)

patch for edit-comments against trunk

  • edit-comments.php

     
    1818        check_admin_referer('bulk-spam-delete', '_spam_nonce'); 
    1919 
    2020        $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] ); 
    21         $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 
    22  
     21        if ( current_user_can('moderate_comments')) { 
     22                $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 
     23        } else { 
     24                $deleted_spam = 0; 
     25        } 
    2326        $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam; 
    2427        if ( $post_id ) 
    2528                $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); 
     
    275278<?php } 
    276279 
    277280if ( 'spam' == $comment_status ) { 
    278         wp_nonce_field('bulk-spam-delete', '_spam_nonce'); ?> 
    279 <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" /> 
    280 <?php } ?> 
     281        wp_nonce_field('bulk-spam-delete', '_spam_nonce');  
     282        if ( current_user_can ('moderate_comments')) { ?> 
     283                <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" /> 
     284        <?php } 
     285 } ?> 
    281286<?php do_action('manage_comments_nav', $comment_status); ?> 
    282287</div> 
    283288