Fix post comments box and remove unused 'add-comment' ajax action. See #15338
git-svn-id: http://svn.automattic.com/wordpress/trunk@16371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
06bf76e44f
commit
e1c3e15de4
|
@ -519,8 +519,7 @@ case 'add-tag' :
|
|||
$x->send();
|
||||
}
|
||||
|
||||
if ( isset($_POST['screen']) )
|
||||
set_current_screen($_POST['screen']);
|
||||
set_current_screen( $_POST['screen'] );
|
||||
|
||||
$wp_list_table = get_list_table('WP_Terms_List_Table');
|
||||
|
||||
|
@ -581,33 +580,6 @@ case 'get-tagcloud' :
|
|||
|
||||
exit;
|
||||
break;
|
||||
case 'add-comment' :
|
||||
check_ajax_referer( $action );
|
||||
if ( !current_user_can( 'edit_posts' ) )
|
||||
die('-1');
|
||||
|
||||
$wp_list_table = get_list_table('WP_Comments_List_Table');
|
||||
$wp_list_table->from_ajax = true;
|
||||
|
||||
$wp_list_table->prepare_items();
|
||||
|
||||
if ( !$wp_list_table->has_items() )
|
||||
die('1');
|
||||
|
||||
$x = new WP_Ajax_Response();
|
||||
foreach ( $wp_list_table->items as $comment ) {
|
||||
ob_start();
|
||||
$wp_list_table->single_row( $comment );
|
||||
$comment_list_item = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$x->add( array(
|
||||
'what' => 'comment',
|
||||
'id' => $comment->comment_ID,
|
||||
'data' => $comment_list_item
|
||||
) );
|
||||
}
|
||||
$x->send();
|
||||
break;
|
||||
case 'get-comments' :
|
||||
check_ajax_referer( $action );
|
||||
|
||||
|
@ -615,6 +587,8 @@ case 'get-comments' :
|
|||
if ( !current_user_can( 'edit_post', $post_ID ) )
|
||||
die('-1');
|
||||
|
||||
set_current_screen( 'edit-comments' );
|
||||
|
||||
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
|
||||
|
||||
$wp_list_table->prepare_items();
|
||||
|
@ -1161,8 +1135,7 @@ case 'inline-save':
|
|||
die( __('You are not allowed to edit this post.') );
|
||||
}
|
||||
|
||||
if ( isset($_POST['screen']) )
|
||||
set_current_screen($_POST['screen']);
|
||||
set_current_screen( $_POST['screen'] );
|
||||
|
||||
if ( $last = wp_check_post_lock( $post_ID ) ) {
|
||||
$last_user = get_userdata( $last );
|
||||
|
@ -1209,7 +1182,7 @@ case 'inline-save':
|
|||
case 'inline-save-tax':
|
||||
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
||||
|
||||
set_current_screen('edit-' . $_POST['taxonomy']);
|
||||
set_current_screen( 'edit-' . $_POST['taxonomy'] );
|
||||
|
||||
$wp_list_table = get_list_table('WP_Terms_List_Table');
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
var $checkbox = true;
|
||||
var $from_ajax = false;
|
||||
|
||||
var $pending_count = array();
|
||||
|
||||
|
@ -411,7 +410,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
|
||||
|
||||
// Reply and quickedit need a hide-if-no-js span when not added with ajax
|
||||
if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $this->from_ajax )
|
||||
if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
|
||||
$action .= ' hide-if-no-js';
|
||||
elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
|
||||
if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
|
||||
|
|
Loading…
Reference in New Issue