WP_User_Query constructor improvements. Props filosofo. Fixes #14709
git-svn-id: http://svn.automattic.com/wordpress/trunk@15543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
253faa4bbe
commit
e675b1e837
|
@ -333,7 +333,7 @@ function delete_user_option( $user_id, $option_name, $global = false ) {
|
||||||
class WP_User_Query {
|
class WP_User_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@internal Missing Description}}
|
* List of found user ids
|
||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -342,7 +342,7 @@ class WP_User_Query {
|
||||||
var $results;
|
var $results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The total number of users for the current query
|
* Total number of found users for the current query
|
||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -350,31 +350,41 @@ class WP_User_Query {
|
||||||
*/
|
*/
|
||||||
var $total_users = 0;
|
var $total_users = 0;
|
||||||
|
|
||||||
|
// SQL pieces
|
||||||
var $query_from;
|
var $query_from;
|
||||||
var $query_where;
|
var $query_where;
|
||||||
var $query_orderby;
|
var $query_orderby;
|
||||||
var $query_limit;
|
var $query_limit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the object properties.
|
* PHP4 constructor
|
||||||
|
*/
|
||||||
|
function WP_User_Query( $query = null ) {
|
||||||
|
$this->__construct( $query );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP5 constructor
|
||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*
|
*
|
||||||
* @param string|array $args The query variables
|
* @param string|array $args The query variables
|
||||||
* @return WP_User_Query
|
* @return WP_User_Query
|
||||||
*/
|
*/
|
||||||
function WP_User_Query( $query ) {
|
function __construct( $query = null ) {
|
||||||
$this->query_vars = wp_parse_args( $query, array(
|
if ( !empty( $query ) ) {
|
||||||
'search' => '', 'role' => '',
|
$this->query_vars = wp_parse_args( $query, array(
|
||||||
'offset' => '', 'number' => '', 'count_total' => true,
|
'search' => '', 'role' => '',
|
||||||
'orderby' => 'login', 'order' => 'ASC',
|
'offset' => '', 'number' => '', 'count_total' => true,
|
||||||
'meta_key' => '', 'meta_value' => '',
|
'orderby' => 'login', 'order' => 'ASC',
|
||||||
'include' => array(), 'exclude' => array(),
|
'meta_key' => '', 'meta_value' => '',
|
||||||
'fields' => 'all'
|
'include' => array(), 'exclude' => array(),
|
||||||
) );
|
'fields' => 'all'
|
||||||
|
) );
|
||||||
|
|
||||||
$this->prepare_query();
|
$this->prepare_query();
|
||||||
$this->query();
|
$this->query();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue