Make WordPress Core

Ticket #28434: 28434.patch

File 28434.patch, 788 bytes (added by mordauk, 11 years ago)

Adds support for 'fields' parameter

  • wp-includes/comment.php

     
    245245
    246246                $defaults = array(
    247247                        'author_email' => '',
     248                        'fields' => '',
    248249                        'ID' => '',
    249250                        'karma' => '',
    250251                        'number' => '',
     
    368369                if ( $this->query_vars['count'] ) {
    369370                        $fields = 'COUNT(*)';
    370371                } else {
    371                         $fields = '*';
     372                        switch ( strtolower( $this->query_vars['fields'] ) ) {
     373                                case 'ids':
     374                                        $fields = "$wpdb->comments.comment_ID";
     375                                        break;
     376                                case 'id=>parent':
     377                                        $fields = "$wpdb->comments.comment_ID, $wpdb->comments.comment_post_ID";
     378                                        break;
     379                                default:
     380                                        $fields = "*";
     381                        }
    372382                }
     383
    373384                $join = '';
    374385                $where = $approved;
    375386