Make WordPress Core

Ticket #29885: 29885.2.diff

File 29885.2.diff, 1.6 KB (added by nofearinc, 11 years ago)

rename post_author_ fields

  • wp-includes/comment.php

     
    258258         *
    259259         * @since 3.1.0
    260260         * @since 4.1.0 Introduced 'comment__in', 'comment__not_in',
     261         *              'post_author__in', 'post_author__not_in',
    261262         *              'post__in', and 'post__not_in' to $query_vars.
    262263         *
    263264         * @param string|array $query_vars
     
    278279                        'orderby' => '',
    279280                        'order' => 'DESC',
    280281                        'parent' => '',
     282                        'post_author__in' => '',
     283                        'post_author__not_in' => '',
    281284                        'post_ID' => '',
    282285                        'post_id' => 0,
    283286                        'post__in' => '',
     
    475478                        foreach( $post_fields as $field_name => $field_value )
    476479                                $where .= $wpdb->prepare( " AND {$wpdb->posts}.{$field_name} = %s", $field_value );
    477480                }
     481               
     482                if ( ! empty( $this->query_vars['post_author__in'] ) ) {
     483                        if ( empty( $join ) ) {
     484                                $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
     485                        }
     486                        $where .= ' AND post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )';
     487                }
    478488
     489                if ( ! empty( $this->query_vars['post_author__not_in'] ) ) {
     490                        if ( empty( $join ) ) {
     491                                $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
     492                        }
     493                        $where .= ' AND post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )';
     494                }
     495
    479496                if ( ! empty( $this->meta_query->queries ) ) {
    480497                        $clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this );
    481498                        $join .= $clauses['join'];