Make WordPress Core

Changeset 22068


Ignore:
Timestamp:
09/27/2012 06:08:02 PM (12 years ago)
Author:
ryan
Message:

Allow get_comments() to query for explicit value of comment_approved.

Props dd32, nbachiyski
fixes #21101

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r21996 r22068  
    224224            'search' => '',
    225225            'count' => false,
    226             // lets us override the status query var by explicitly setting a value for comment_approved
    227             'comment_approved' => false,
    228226        );
    229227
     
    251249        elseif ( 'approve' == $status )
    252250            $approved = "comment_approved = '1'";
    253         elseif ( 'spam' == $status )
    254             $approved = "comment_approved = 'spam'";
    255         elseif ( 'trash' == $status )
    256             $approved = "comment_approved = 'trash'";
     251        elseif ( ! empty( $status ) )
     252            $approved = $wpdb->prepare( "comment_approved = %s", $status );
    257253        else
    258254            $approved = "( comment_approved = '0' OR comment_approved = '1' )";
    259 
    260         if ( false !== $comment_approved ) {
    261             $approved = $wpdb->prepare( 'comment_approved = %s', $comment_approved );
    262         }
    263255
    264256        $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC';
Note: See TracChangeset for help on using the changeset viewer.