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

git-svn-id: https://develop.svn.wordpress.org/trunk@9098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2008-10-08 01:18:16 +00:00
parent 608a92c414
commit 8dd896218b
10 changed files with 357 additions and 206 deletions

View File

@@ -444,7 +444,7 @@ case 'replyto-comment' :
$comment_author = $wpdb->escape($user->display_name);
$comment_author_email = $wpdb->escape($user->user_email);
$comment_author_url = $wpdb->escape($user->user_url);
$comment_content = trim($_POST['comment']);
$comment_content = trim($_POST['content']);
if ( current_user_can('unfiltered_html') ) {
if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate
@@ -486,6 +486,43 @@ case 'replyto-comment' :
'position' => $position
));
$x->send();
break;
case 'edit-comment' :
check_ajax_referer( 'replyto-comment' );
$comment_post_ID = (int) $_POST['comment_post_ID'];
if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
die('-1');
if ( '' == $_POST['content'] )
die( __('Error: please type a comment.') );
$comment_id = (int) $_POST['comment_ID'];
$_POST['comment_status'] = $_POST['status'];
edit_comment();
$mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
if ( get_option('show_avatars') && 'single' != $mode )
add_filter( 'comment_author', 'floated_admin_avatar' );
$x = new WP_Ajax_Response();
ob_start();
_wp_comment_row( $comment_id, $mode, false, $checkbox );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'edit_comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position
));
$x->send();
break;
case 'add-meta' :