Make WordPress Core

Changeset 18100


Ignore:
Timestamp:
06/01/2011 07:23:19 PM (14 years ago)
Author:
ryan
Message:

Decrement pending count after Approve and Reply. Props DH-Shredder. fixes #17380

File:
1 edited

Legend:

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

    r18010 r18100  
    661661
    662662    $comment_parent = absint($_POST['comment_ID']);
     663    $comment_auto_approved = false;
    663664    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
    664665
     
    668669
    669670    $position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
     671
     672
     673    // automatically approve parent comment
     674    if ( !empty($_POST['approve_parent']) ) {
     675        $parent = get_comment( $comment_parent );
     676
     677        if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
     678            if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
     679                $comment_auto_approved = true;
     680        }
     681    }
    670682
    671683    ob_start();
     
    691703    );
    692704
    693     // automatically approve parent comment
    694     if ( !empty($_POST['approve_parent']) ) {
    695         $parent = get_comment( $comment_parent );
    696 
    697         if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
    698             if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
    699                 $response['supplemental'] = array( 'parent_approved' => $parent->comment_ID );
    700         }
    701     }
     705    if ( $comment_auto_approved )
     706        $response['supplemental'] = array( 'parent_approved' => $parent->comment_ID );
    702707
    703708    $x = new WP_Ajax_Response();
Note: See TracChangeset for help on using the changeset viewer.