WordPress.org

Make WordPress Core

Changeset 16371


Ignore:
Timestamp:
11/14/2010 06:19:45 PM (8 years ago)
Author:
scribu
Message:

Fix post comments box and remove unused 'add-comment' ajax action. See #15338

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r16369 r16371  
    520520    }
    521521
    522     if ( isset($_POST['screen']) )
    523         set_current_screen($_POST['screen']);
     522    set_current_screen( $_POST['screen'] );
    524523
    525524    $wp_list_table = get_list_table('WP_Terms_List_Table');
     
    582581    exit;
    583582    break;
    584 case 'add-comment' :
    585     check_ajax_referer( $action );
    586     if ( !current_user_can( 'edit_posts' ) )
    587         die('-1');
    588 
    589     $wp_list_table = get_list_table('WP_Comments_List_Table');
    590     $wp_list_table->from_ajax = true;
    591 
    592     $wp_list_table->prepare_items();
    593 
    594     if ( !$wp_list_table->has_items() )
    595         die('1');
    596 
    597     $x = new WP_Ajax_Response();
    598     foreach ( $wp_list_table->items as $comment ) {
    599         ob_start();
    600             $wp_list_table->single_row( $comment );
    601             $comment_list_item = ob_get_contents();
    602         ob_end_clean();
    603         $x->add( array(
    604             'what' => 'comment',
    605             'id' => $comment->comment_ID,
    606             'data' => $comment_list_item
    607         ) );
    608     }
    609     $x->send();
    610     break;
    611583case 'get-comments' :
    612584    check_ajax_referer( $action );
     
    615587    if ( !current_user_can( 'edit_post', $post_ID ) )
    616588        die('-1');
     589
     590    set_current_screen( 'edit-comments' );
    617591
    618592    $wp_list_table = get_list_table('WP_Post_Comments_List_Table');
     
    11621136    }
    11631137
    1164     if ( isset($_POST['screen']) )
    1165         set_current_screen($_POST['screen']);
     1138    set_current_screen( $_POST['screen'] );
    11661139
    11671140    if ( $last = wp_check_post_lock( $post_ID ) ) {
     
    12101183    check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
    12111184
    1212     set_current_screen('edit-' . $_POST['taxonomy']);
     1185    set_current_screen( 'edit-' . $_POST['taxonomy'] );
    12131186
    12141187    $wp_list_table = get_list_table('WP_Terms_List_Table');
  • trunk/wp-admin/includes/class-wp-comments-list-table.php

    r16356 r16371  
    1818
    1919    var $checkbox = true;
    20     var $from_ajax = false;
    2120
    2221    var $pending_count = array();
     
    412411
    413412                // Reply and quickedit need a hide-if-no-js span when not added with ajax
    414                 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $this->from_ajax )
     413                if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
    415414                    $action .= ' hide-if-no-js';
    416415                elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
Note: See TracChangeset for help on using the changeset viewer.