From 99421d1799b5e45580b1bf6ab5583613121708ed Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 8 Oct 2015 21:06:23 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34956 git-svn-id: http://core.svn.wordpress.org/trunk@34921 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-user-query.php | 15 ++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-wp-user-query.php b/wp-includes/class-wp-user-query.php index 1bc08aa491..8f06450d55 100644 --- a/wp-includes/class-wp-user-query.php +++ b/wp-includes/class-wp-user-query.php @@ -52,6 +52,15 @@ class WP_User_Query { */ public $meta_query = false; + /** + * The SQL query used to fetch matching users. + * + * @since 4.4.0 + * @access public + * @var string + */ + public $request; + private $compat_fields = array( 'results', 'total_users' ); // SQL clauses @@ -442,12 +451,12 @@ class WP_User_Query { $qv =& $this->query_vars; - $query = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"; + $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"; if ( is_array( $qv['fields'] ) || 'all' == $qv['fields'] ) { - $this->results = $wpdb->get_results( $query ); + $this->results = $wpdb->get_results( $this->request ); } else { - $this->results = $wpdb->get_col( $query ); + $this->results = $wpdb->get_col( $this->request ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 91ed1b373f..3e873ea653 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34955'; +$wp_version = '4.4-alpha-34956'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.