From 8ec2d2a151617f78ea577ab9ddbe1c8b47f6f3b3 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Mon, 6 Oct 2014 15:36:17 +0000 Subject: [PATCH] Add inline documentation for `WP_User_Query` default arguments in the form of a hash notation. Adds documentation pointers from the class-level doc for `WP_User_Query`, as well as the `get_users()` doc. Props tschutter. Fixes #29846. Built from https://develop.svn.wordpress.org/trunk@29843 git-svn-id: http://core.svn.wordpress.org/trunk@29607 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 46 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index 1d00523d0c..b5f05935bc 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -439,6 +439,8 @@ function delete_user_option( $user_id, $option_name, $global = false ) { * WordPress User Query class. * * @since 3.1.0 + * + * @see WP_User_Query::prepare_query() for information on accepted arguments. */ class WP_User_Query { @@ -495,8 +497,45 @@ class WP_User_Query { * Prepare the query variables. * * @since 3.1.0 + * @access public * - * @param string|array $args Optional. The query variables. + * @param string|array $query { + * Optional. Array or string of Query parameters. + * + * @type int $blog_id The site ID. Default is the global blog id. + * @type string $role Role name. Default empty. + * @type string $meta_key User meta key. Default empty. + * @type string $meta_value User meta value. Default empty. + * @type string $meta_compare Comparison operator to test the `$meta_value`. Accepts '=', '!=', + * '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', + * 'NOT BETWEEN', 'EXISTS', 'NOT EXISTS', 'REGEXP', 'NOT REGEXP', + * or 'RLIKE'. Default '='. + * @type array $include An array of user IDs to include. Default empty array. + * @type array $exclude An array of user IDs to exclude. Default empty array. + * @type string $search Search keyword. Searches for possible string matches on columns. + * When `$search_columns` is left empty, it tries to determine which + * column to search in based on search string. Default empty. + * @type array $search_columns Array of column names to be searched. Accepts 'ID', 'login', + * 'nicename', 'email', 'url'. Default empty array. + * @type string $orderby Field to sort the retrieved users by. Accepts 'ID', 'display_name', + * 'login', 'nicename', 'email', 'url', 'registered', 'post_count', or + * 'meta_value'. To use 'meta_value', `$meta_key` must be also be defined. + * Default 'user_login'. + * @type string $order Designates ascending or descending order of users. Accepts 'ASC', + * 'DESC'. Default 'ASC'. + * @type int $offset Number of users to offset in retrieved results. Can be used in + * conjunction with pagination. Default 0. + * @type int $number Number of users to limit the query for. Can be used in conjunction + * with pagination. Value -1 (all) is not supported. + * Default empty (all users). + * @type bool $count_total Whether to count the total number of users found. If pagination is not + * needed, setting this to false can improve performance. Default true. + * @type string|array $fields Which fields to return. Single or all fields (string), or array + * of fields. Accepts 'ID', 'display_name', 'login', 'nicename', 'email', + * 'url', 'registered'. Use 'all' for all fields and 'all_with_meta' to + * include meta fields. Default 'all'. + * @type string $who Type of users to query. Accepts 'authors'. Default empty (all users). + * } */ public function prepare_query( $query = array() ) { global $wpdb; @@ -924,9 +963,10 @@ class WP_User_Query { * * @since 3.1.0 * - * @uses WP_User_Query See for default arguments and information. + * @see WP_User_Query * - * @param array $args Optional. Array of arguments. + * @param array $args Optional. Arguments to retrieve users. See {@see WP_User_Query::prepare_query()} + * for more information on accepted arguments. * @return array List of users. */ function get_users( $args = array() ) {