From 52e69011ad05afc81be56b684408a41a65a9da6d Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 5 Nov 2012 16:49:10 +0000 Subject: [PATCH] When approving and then replying to a comment, approve the parent comment before inserting the reply. props trepmal, fixes #22000. git-svn-id: https://develop.svn.wordpress.org/trunk@22370 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ajax-actions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index b842dfadc3..53bfe328fc 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -749,12 +749,6 @@ function wp_ajax_replyto_comment( $action ) { $comment_auto_approved = false; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); - $comment_id = wp_new_comment( $commentdata ); - $comment = get_comment($comment_id); - if ( ! $comment ) wp_die( 1 ); - - $position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; - // automatically approve parent comment if ( !empty($_POST['approve_parent']) ) { $parent = get_comment( $comment_parent ); @@ -765,6 +759,12 @@ function wp_ajax_replyto_comment( $action ) { } } + $comment_id = wp_new_comment( $commentdata ); + $comment = get_comment($comment_id); + if ( ! $comment ) wp_die( 1 ); + + $position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; + ob_start(); if ( 'dashboard' == $_REQUEST['mode'] ) { require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );