$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
$comment = (int) $comment;
- $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
- // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
+ $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
if ( !current_user_can('edit_post', $post_id) )
continue;
if ( !empty( $_REQUEST['spamit'] ) ) {
}
endforeach;
$redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed . '&unapproved=' . $comments_unapproved;
+ if ( isset($_REQUEST['apage']) )
+ $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
if ( !empty($_REQUEST['mode']) )
$redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
if ( !empty($_REQUEST['comment_status']) )
<?php
$status_links = array();
$num_comments = wp_count_comments();
-$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "<span class='comment-count'>$num_comments->moderated</span>"), 'approved' => _c('Approved|plural'));
+$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
$class = ( '' === $comment_status ) ? ' class="current"' : '';
$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
foreach ( $stati as $status => $label ) {
</ul>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
</p>
<?php
+$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
-$start = $offset = ( $page - 1 ) * 20;
+$start = $offset = ( $page - 1 ) * $comments_per_page;
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
-$comments = array_slice($_comments, 0, 20);
-$extra_comments = array_slice($_comments, 20);
+$comments = array_slice($_comments, 0, $comments_per_page);
+$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
- 'total' => ceil($total / 20),
+ 'total' => ceil($total / $comments_per_page),
'current' => $page
));
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php do_action('manage_comments_nav', $comment_status); ?>
<?php wp_nonce_field('bulk-comments'); ?>
+<?php if ( isset($_GET['apage']) ) { ?>
+ <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
+<?php } ?>
</div>
<br class="clear" />
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Comment') ?></th>
<th scope="col"><?php _e('Date') ?></th>
<th scope="col" class="action-links"><?php _e('Actions') ?></th>