From 9805f3a4b0f702744a7eefec06fe03615c369c25 Mon Sep 17 00:00:00 2001 From: scribu Date: Thu, 12 Aug 2010 23:58:49 +0000 Subject: [PATCH] Fix Comments meta box in post editing screen. See #14579 git-svn-id: https://develop.svn.wordpress.org/trunk@15497 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-ajax.php | 14 ++++++-------- wp-admin/includes/default-list-tables.php | 2 +- wp-admin/includes/meta-boxes.php | 6 +++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 9dd4eec5bb..75e02feb20 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -627,17 +627,16 @@ case 'add-comment' : require_once( './includes/default-list-tables.php' ); $table = new WP_Comments_Table(); + $table->prepare_items(); - global $comments; - - if ( !$comments ) + if ( !$table->has_items() ) die('1'); if ( get_option('show_avatars') ) add_filter( 'comment_author', 'floated_admin_avatar' ); $x = new WP_Ajax_Response(); - foreach ( (array) $comments as $comment ) { + foreach ( $table->items as $comment ) { get_comment( $comment ); ob_start(); $table->single_row( $comment->comment_ID, $mode, $status, true, true ); @@ -660,15 +659,14 @@ case 'get-comments' : require_once( './includes/default-list-tables.php' ); $table = new WP_Comments_Table(); + $table->prepare_items(); - global $comments; - - if ( !$comments ) + if ( !$table->has_items() ) die('1'); $comment_list_item = ''; $x = new WP_Ajax_Response(); - foreach ( (array) $comments as $comment ) { + foreach ( $table->items as $comment ) { get_comment( $comment ); ob_start(); $table->single_row( $comment->comment_ID, 'single', false, false ); diff --git a/wp-admin/includes/default-list-tables.php b/wp-admin/includes/default-list-tables.php index be650e15b9..3c79aa4da4 100644 --- a/wp-admin/includes/default-list-tables.php +++ b/wp-admin/includes/default-list-tables.php @@ -2111,7 +2111,7 @@ class WP_Comments_Table extends WP_List_Table { } function prepare_items() { - global $comments, $extra_comments, $total_comments, $post_id, $comment_status, $mode; + global $post_id, $comment_status, $mode; $post_id = isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : 0; diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 2012951eef..71c871a2e7 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -460,11 +460,15 @@ function post_comment_meta_box($post) { wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1); + add_filter('manage_edit-comments_sortable_columns', create_function('', 'return array();'), 8); + + require_once( './includes/default-list-tables.php' ); + $table = new WP_Comments_Table; ?> - + print_column_headers(); ?>