diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
index 555efc3aaa..6ad9ff98ce 100644
--- a/wp-admin/admin-header.php
+++ b/wp-admin/admin-header.php
@@ -87,7 +87,7 @@ if ( 'index.php' == $pagenow ) {
$breadcrumb = '' . __('Dashboard') . ' › ' . $title;
}
?>
-
query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'" );
wp_redirect('edit-comments.php?deleted=' . (int) $deleted_spam);
}
-if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
+if ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
check_admin_referer('bulk-comments');
+ $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
+
+ $deleted = $approved = $unapproved = $spammed = 0;
+ foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
+ $comment_id = (int) $comment_id;
+ $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
- $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( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
if ( !current_user_can('edit_post', $post_id) )
continue;
- if ( $_REQUEST['action'] == 'markspam' ) {
- wp_set_comment_status($comment, 'spam');
- $comments_spammed++;
- } elseif ( $_REQUEST['action'] == 'delete' ) {
- wp_set_comment_status($comment, 'delete');
- $comments_deleted++;
- } elseif ( $_REQUEST['action'] == 'approve' ) {
- wp_set_comment_status($comment, 'approve');
- $comments_approved++;
- } elseif ( $_REQUEST['action'] == 'unapprove' ) {
- wp_set_comment_status($comment, 'hold');
- $comments_unapproved++;
+
+ switch( $doaction ) {
+ case 'markspam' :
+ wp_set_comment_status($comment_id, 'spam');
+ $spammed++;
+ break;
+ case 'delete' :
+ wp_set_comment_status($comment_id, 'delete');
+ $deleted++;
+ break;
+ case 'approve' :
+ wp_set_comment_status($comment_id, 'approve');
+ $approved++;
+ break;
+ case 'unapprove' :
+ wp_set_comment_status($comment_id, 'hold');
+ $unapproved++;
+ break;
}
endforeach;
- $redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed . '&unapproved=' . $comments_unapproved;
+
+ $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
if ( isset($_REQUEST['apage']) )
$redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
if ( !empty($_REQUEST['mode']) )
@@ -54,8 +63,8 @@ if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
if ( !empty($_REQUEST['s']) )
$redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
wp_redirect( $redirect_to );
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
- wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+ wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}
@@ -111,6 +120,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
}
}
?>
+
@@ -143,7 +153,6 @@ unset($status_links);
-
+
+
+
+$page_links
";
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+