More comment functions can accept a full object instead of comment_ID to reduce cache/db lookups.
See ##33638. Built from https://develop.svn.wordpress.org/trunk@34129 git-svn-id: http://core.svn.wordpress.org/trunk@34097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -278,11 +278,11 @@ case 'unapprovecomment' :
|
||||
$redir = add_query_arg( array('unspammed' => '1'), $redir );
|
||||
break;
|
||||
case 'approvecomment' :
|
||||
wp_set_comment_status( $comment_id, 'approve' );
|
||||
wp_set_comment_status( $comment, 'approve' );
|
||||
$redir = add_query_arg( array( 'approved' => 1 ), $redir );
|
||||
break;
|
||||
case 'unapprovecomment' :
|
||||
wp_set_comment_status( $comment_id, 'hold' );
|
||||
wp_set_comment_status( $comment, 'hold' );
|
||||
$redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ function wp_ajax_delete_comment() {
|
||||
wp_die( -1 );
|
||||
|
||||
check_ajax_referer( "delete-comment_$id" );
|
||||
$status = wp_get_comment_status( $comment->comment_ID );
|
||||
$status = wp_get_comment_status( $comment );
|
||||
|
||||
$delta = -1;
|
||||
if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
|
||||
@@ -730,15 +730,16 @@ function wp_ajax_dim_comment() {
|
||||
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) )
|
||||
wp_die( -1 );
|
||||
|
||||
$current = wp_get_comment_status( $comment->comment_ID );
|
||||
$current = wp_get_comment_status( $comment );
|
||||
if ( isset( $_POST['new'] ) && $_POST['new'] == $current )
|
||||
wp_die( time() );
|
||||
|
||||
check_ajax_referer( "approve-comment_$id" );
|
||||
if ( in_array( $current, array( 'unapproved', 'spam' ) ) )
|
||||
$result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
|
||||
else
|
||||
$result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
|
||||
if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
|
||||
$result = wp_set_comment_status( $comment, 'approve', true );
|
||||
} else {
|
||||
$result = wp_set_comment_status( $comment, 'hold', true );
|
||||
}
|
||||
|
||||
if ( is_wp_error($result) ) {
|
||||
$x = new WP_Ajax_Response( array(
|
||||
@@ -1015,7 +1016,7 @@ function wp_ajax_replyto_comment( $action ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
|
||||
if ( wp_set_comment_status( $parent, 'approve' ) )
|
||||
$comment_auto_approved = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user