Fix Comments meta box in post editing screen. See #14579

git-svn-id: http://svn.automattic.com/wordpress/trunk@15497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-08-12 23:58:49 +00:00
parent c6056827ed
commit b921471dea
3 changed files with 12 additions and 10 deletions

View File

@ -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 );

View File

@ -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;

View File

@ -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;
?>
<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
<thead><tr>
<?php print_column_headers('edit-comments'); ?>
<?php $table->print_column_headers(); ?>
</tr></thead>
<tbody id="the-comment-list" class="list:comment"></tbody>
</table>