Fix post comments box and remove unused 'add-comment' ajax action. See #15338
git-svn-id: https://develop.svn.wordpress.org/trunk@16371 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9ff9211249
commit
9f69a2211f
|
@ -519,8 +519,7 @@ case 'add-tag' :
|
||||||
$x->send();
|
$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');
|
$wp_list_table = get_list_table('WP_Terms_List_Table');
|
||||||
|
|
||||||
|
@ -581,33 +580,6 @@ case 'get-tagcloud' :
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
break;
|
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' :
|
case 'get-comments' :
|
||||||
check_ajax_referer( $action );
|
check_ajax_referer( $action );
|
||||||
|
|
||||||
|
@ -615,6 +587,8 @@ case 'get-comments' :
|
||||||
if ( !current_user_can( 'edit_post', $post_ID ) )
|
if ( !current_user_can( 'edit_post', $post_ID ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
|
|
||||||
|
set_current_screen( 'edit-comments' );
|
||||||
|
|
||||||
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
|
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
|
||||||
|
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
@ -1161,8 +1135,7 @@ case 'inline-save':
|
||||||
die( __('You are not allowed to edit this post.') );
|
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 ) ) {
|
if ( $last = wp_check_post_lock( $post_ID ) ) {
|
||||||
$last_user = get_userdata( $last );
|
$last_user = get_userdata( $last );
|
||||||
|
@ -1209,7 +1182,7 @@ case 'inline-save':
|
||||||
case 'inline-save-tax':
|
case 'inline-save-tax':
|
||||||
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
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');
|
$wp_list_table = get_list_table('WP_Terms_List_Table');
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
class WP_Comments_List_Table extends WP_List_Table {
|
class WP_Comments_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
var $checkbox = true;
|
var $checkbox = true;
|
||||||
var $from_ajax = false;
|
|
||||||
|
|
||||||
var $pending_count = array();
|
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 = ' | ';
|
( ( ( '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
|
// 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';
|
$action .= ' hide-if-no-js';
|
||||||
elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
|
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 ) )
|
if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
|
||||||
|
|
Loading…
Reference in New Issue