Skip to content

Commit

Permalink
Show 'Delete All Spam' only if can moderate_comments. Props mrmist. f…
Browse files Browse the repository at this point in the history
…ixes #8684 for 2.7

git-svn-id: http://svn.automattic.com/wordpress/branches/2.7@10264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Dec 30, 2008
1 parent 62d71ca commit f06e4fc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions wp-admin/edit-comments.php
Expand Up @@ -18,8 +18,11 @@
check_admin_referer('bulk-spam-delete', '_spam_nonce');

$delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
$deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );

if ( current_user_can('moderate_comments')) {
$deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
} else {
$deleted_spam = 0;
}
$redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
if ( $post_id )
$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
Expand Down Expand Up @@ -272,9 +275,11 @@
<?php }

if ( 'spam' == $comment_status ) {
wp_nonce_field('bulk-spam-delete', '_spam_nonce'); ?>
<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php } ?>
wp_nonce_field('bulk-spam-delete', '_spam_nonce');
if ( current_user_can ('moderate_comments')) { ?>
<input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
<?php }
} ?>
<?php do_action('manage_comments_nav', $comment_status); ?>
</div>

Expand Down

0 comments on commit f06e4fc

Please sign in to comment.