WordPress.org

Make WordPress Core

Ticket #11442: 11442.3.diff

File 11442.3.diff, 738 bytes (added by nacin, 4 years ago)
  • wp-includes/comment.php

     
    12631263 
    12641264        $comment_old = wp_clone(get_comment($comment_id)); 
    12651265 
     1266        if ( 'trash' == $comment_old->comment_approved && $status != 'trash' ) 
     1267                wp_untrash_comment( $comment_id ); 
     1268        elseif ( 'spam' == $comment_old->comment_approved && $status != 'spam' ) 
     1269                wp_unspam_comment( $comment_id ); 
     1270 
    12661271        if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { 
    12671272                if ( $wp_error ) 
    12681273                        return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);