~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/class-wp-user-query.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
                        $blog_id = absint( $qv['blog_id'] );
256
256
                }
257
257
 
258
 
                if ( isset( $qv['who'] ) && 'authors' == $qv['who'] && $blog_id ) {
259
 
                        $qv['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'user_level';
260
 
                        $qv['meta_value'] = 0;
261
 
                        $qv['meta_compare'] = '!=';
262
 
                        $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query
263
 
                }
264
 
 
265
258
                if ( $qv['has_published_posts'] && $blog_id ) {
266
259
                        if ( true === $qv['has_published_posts'] ) {
267
260
                                $post_types = get_post_types( array( 'public' => true ) );
281
274
                $this->meta_query = new WP_Meta_Query();
282
275
                $this->meta_query->parse_query_vars( $qv );
283
276
 
 
277
                if ( isset( $qv['who'] ) && 'authors' == $qv['who'] && $blog_id ) {
 
278
                        $who_query = array(
 
279
                                'key' => $wpdb->get_blog_prefix( $blog_id ) . 'user_level',
 
280
                                'value' => 0,
 
281
                                'compare' => '!=',
 
282
                        );
 
283
 
 
284
                        // Prevent extra meta query.
 
285
                        $qv['blog_id'] = $blog_id = 0;
 
286
 
 
287
                        if ( empty( $this->meta_query->queries ) ) {
 
288
                                $this->meta_query->queries = array( $who_query );
 
289
                        } else {
 
290
                                // Append the cap query to the original queries and reparse the query.
 
291
                                $this->meta_query->queries = array(
 
292
                                        'relation' => 'AND',
 
293
                                        array( $this->meta_query->queries, $who_query ),
 
294
                                );
 
295
                        }
 
296
 
 
297
                        $this->meta_query->parse_query_vars( $this->meta_query->queries );
 
298
                }
 
299
 
284
300
                $roles = array();
285
301
                if ( isset( $qv['role'] ) ) {
286
302
                        if ( is_array( $qv['role'] ) ) {
464
480
                        }
465
481
 
466
482
                        /**
467
 
                         * Filter the columns to search in a WP_User_Query search.
 
483
                         * Filters the columns to search in a WP_User_Query search.
468
484
                         *
469
485
                         * The default columns depend on the search term, and include 'user_email',
470
486
                         * 'user_login', 'ID', 'user_url', 'display_name', and 'user_nicename'.
531
547
                }
532
548
 
533
549
                /**
534
 
                 * Filter SELECT FOUND_ROWS() query for the current WP_User_Query instance.
 
550
                 * Filters SELECT FOUND_ROWS() query for the current WP_User_Query instance.
535
551
                 *
536
552
                 * @since 3.2.0
537
553
                 *
720
736
        }
721
737
 
722
738
        /**
723
 
         * Make private properties readable for backwards compatibility.
 
739
         * Make private properties readable for backward compatibility.
724
740
         *
725
741
         * @since 4.0.0
726
742
         * @access public
735
751
        }
736
752
 
737
753
        /**
738
 
         * Make private properties settable for backwards compatibility.
 
754
         * Make private properties settable for backward compatibility.
739
755
         *
740
756
         * @since 4.0.0
741
757
         * @access public
751
767
        }
752
768
 
753
769
        /**
754
 
         * Make private properties checkable for backwards compatibility.
 
770
         * Make private properties checkable for backward compatibility.
755
771
         *
756
772
         * @since 4.0.0
757
773
         * @access public
766
782
        }
767
783
 
768
784
        /**
769
 
         * Make private properties un-settable for backwards compatibility.
 
785
         * Make private properties un-settable for backward compatibility.
770
786
         *
771
787
         * @since 4.0.0
772
788
         * @access public
780
796
        }
781
797
 
782
798
        /**
783
 
         * Make private/protected methods readable for backwards compatibility.
 
799
         * Make private/protected methods readable for backward compatibility.
784
800
         *
785
801
         * @since 4.0.0
786
802
         * @access public