Make WordPress Core


Ignore:
Timestamp:
10/08/2008 01:18:16 AM (17 years ago)
Author:
azaozz
Message:

Convert the comment reply popup to a temp table row for consistency, add Quick Edit for comments, see #7435

File:
1 edited

Legend:

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

    r9083 r9098  
    445445        $comment_author_email = $wpdb->escape($user->user_email);
    446446        $comment_author_url   = $wpdb->escape($user->user_url);
    447         $comment_content      = trim($_POST['comment']);
     447        $comment_content      = trim($_POST['content']);
    448448        if ( current_user_can('unfiltered_html') ) {
    449449            if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
     
    482482    $x->add( array(
    483483        'what' => 'comment',
     484        'id' => $comment->comment_ID,
     485        'data' => $comment_list_item,
     486        'position' => $position
     487    ));
     488
     489    $x->send();
     490    break;
     491case 'edit-comment' :
     492    check_ajax_referer( 'replyto-comment' );
     493
     494    $comment_post_ID = (int) $_POST['comment_post_ID'];
     495    if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
     496        die('-1');
     497
     498    if ( '' == $_POST['content'] )
     499        die( __('Error: please type a comment.') );
     500
     501    $comment_id = (int) $_POST['comment_ID'];
     502    $_POST['comment_status'] = $_POST['status'];
     503    edit_comment();
     504
     505    $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
     506    $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
     507    $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
     508
     509    if ( get_option('show_avatars') && 'single' != $mode )
     510        add_filter( 'comment_author', 'floated_admin_avatar' );
     511
     512    $x = new WP_Ajax_Response();
     513
     514    ob_start();
     515        _wp_comment_row( $comment_id, $mode, false, $checkbox );
     516        $comment_list_item = ob_get_contents();
     517    ob_end_clean();
     518
     519    $x->add( array(
     520        'what' => 'edit_comment',
    484521        'id' => $comment->comment_ID,
    485522        'data' => $comment_list_item,
Note: See TracChangeset for help on using the changeset viewer.