diff --git wp-includes/user.php wp-includes/user.php
index 6b342c8..8e6b345 100644
|
|
class WP_User_Query { |
369 | 369 | */ |
370 | 370 | function __construct( $query = null ) { |
371 | 371 | if ( !empty( $query ) ) { |
372 | | $this->query_vars = wp_parse_args( $query, array( |
373 | | 'blog_id' => $GLOBALS['blog_id'], |
374 | | 'role' => '', |
375 | | 'meta_key' => '', |
376 | | 'meta_value' => '', |
377 | | 'meta_compare' => '', |
378 | | 'include' => array(), |
379 | | 'exclude' => array(), |
380 | | 'search' => '', |
381 | | 'search_columns' => array(), |
382 | | 'orderby' => 'login', |
383 | | 'order' => 'ASC', |
384 | | 'offset' => '', |
385 | | 'number' => '', |
386 | | 'count_total' => true, |
387 | | 'fields' => 'all', |
388 | | 'who' => '' |
389 | | ) ); |
390 | | |
391 | | $this->prepare_query(); |
| 372 | $this->prepare_query( $query ); |
392 | 373 | $this->query(); |
393 | 374 | } |
394 | 375 | } |
… |
… |
class WP_User_Query { |
397 | 378 | * Prepare the query variables |
398 | 379 | * |
399 | 380 | * @since 3.1.0 |
400 | | * @access private |
| 381 | * |
| 382 | * @param string|array $args The query variables |
401 | 383 | */ |
402 | | function prepare_query() { |
| 384 | function prepare_query( $query ) { |
403 | 385 | global $wpdb; |
404 | 386 | |
| 387 | $this->query_vars = wp_parse_args( $query, array( |
| 388 | 'blog_id' => $GLOBALS['blog_id'], |
| 389 | 'role' => '', |
| 390 | 'meta_key' => '', |
| 391 | 'meta_value' => '', |
| 392 | 'meta_compare' => '', |
| 393 | 'include' => array(), |
| 394 | 'exclude' => array(), |
| 395 | 'search' => '', |
| 396 | 'search_columns' => array(), |
| 397 | 'orderby' => 'login', |
| 398 | 'order' => 'ASC', |
| 399 | 'offset' => '', |
| 400 | 'number' => '', |
| 401 | 'count_total' => true, |
| 402 | 'fields' => 'all', |
| 403 | 'who' => '' |
| 404 | ) ); |
| 405 | |
405 | 406 | $qv = &$this->query_vars; |
406 | 407 | |
407 | 408 | if ( is_array( $qv['fields'] ) ) { |
… |
… |
class WP_User_Query { |
544 | 545 | * Execute the query, with the current variables |
545 | 546 | * |
546 | 547 | * @since 3.1.0 |
547 | | * @access private |
548 | 548 | */ |
549 | 549 | function query() { |
550 | 550 | global $wpdb; |
551 | 551 | |
| 552 | $query = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"; |
| 553 | |
552 | 554 | if ( is_array( $this->query_vars['fields'] ) || 'all' == $this->query_vars['fields'] ) { |
553 | | $this->results = $wpdb->get_results("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"); |
| 555 | $this->results = $wpdb->get_results( $query ); |
554 | 556 | } else { |
555 | | $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"); |
| 557 | $this->results = $wpdb->get_col( $query ); |
556 | 558 | } |
557 | 559 | |
558 | 560 | if ( $this->query_vars['count_total'] ) |