diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 57ae7fea7b..6eb2cd977d 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -442,6 +442,36 @@ case 'add-comment' : } $x->send(); break; +case 'get-comments' : + check_ajax_referer( $action ); + + $post_ID = (int) $_POST['post_ID']; + if ( !current_user_can( 'edit_post', $post_ID ) ) + die('-1'); + + $start = isset($_POST['start']) ? intval($_POST['start']) : 0; + $num = isset($_POST['num']) ? intval($_POST['num']) : 10; + + list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID ); + + if ( !$comments ) + die('1'); + + $comment_list_item = ''; + $x = new WP_Ajax_Response(); + foreach ( (array) $comments as $comment ) { + get_comment( $comment ); + ob_start(); + _wp_comment_row( $comment->comment_ID, 'single', false, false ); + $comment_list_item .= ob_get_contents(); + ob_end_clean(); + } + $x->add( array( + 'what' => 'comments', + 'data' => $comment_list_item + ) ); + $x->send(); + break; case 'replyto-comment' : check_ajax_referer( $action ); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index a7feb8e850..647968954a 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -341,17 +341,13 @@ function post_comment_status_meta_box($post) {

comment_count ) return; - if ( !$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $post_ID) ) ) - return; - - // Make sure comments, post, and post_author are cached -// update_comment_cache($comments); +wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); ?> - +
@@ -360,13 +356,9 @@ function post_comment_status_meta_box($post) { - - +

'+wpAjax.broken+''); + } + ); + + return false; + } + } + +})(jQuery); + diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b995cddf75..2f5fe2a8c0 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1083,6 +1083,11 @@ table.form-table td .updated { margin: 11px 0; } +#side-sortables .comments-box, +#side-sortables #show-comments { + display: none; +} + #mediadiv img { float: left; margin-right: 1em; @@ -1975,7 +1980,8 @@ a.togbox { } #replysubmit img.waiting, -.quick-edit-save img.waiting { +.quick-edit-save img.waiting, +#commentstatusdiv img.waiting { padding: 0 10px; vertical-align: top; } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 0073ad0839..2d1eabb74e 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -183,6 +183,8 @@ function wp_default_scripts( &$scripts ) { 'separate' => __('Separate tags with commas'), 'cancel' => __('Cancel'), 'edit' => __('Edit'), + 'showcomm' => __('Show more comments'), + 'endcomm' => __('No more comments found.') ) ); $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox', 'settings-box'), '20080925' ); $scripts->localize( 'page', 'postL10n', array(