Make WordPress Core

Changeset 34956


Ignore:
Timestamp:
10/08/2015 09:05:50 PM (9 years ago)
Author:
boonebgorges
Message:

Store SQL query string as a property on WP_User_Query.

In addition to better parity with other WP query classes, this also allows
testing of SQL strings, should anyone want to do something so foolish.

See #22212.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user-query.php

    r34880 r34956  
    5252     */
    5353    public $meta_query = false;
     54
     55    /**
     56     * The SQL query used to fetch matching users.
     57     *
     58     * @since 4.4.0
     59     * @access public
     60     * @var string
     61     */
     62    public $request;
    5463
    5564    private $compat_fields = array( 'results', 'total_users' );
     
    443452        $qv =& $this->query_vars;
    444453
    445         $query = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
     454        $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
    446455
    447456        if ( is_array( $qv['fields'] ) || 'all' == $qv['fields'] ) {
    448             $this->results = $wpdb->get_results( $query );
     457            $this->results = $wpdb->get_results( $this->request );
    449458        } else {
    450             $this->results = $wpdb->get_col( $query );
     459            $this->results = $wpdb->get_col( $this->request );
    451460        }
    452461
Note: See TracChangeset for help on using the changeset viewer.