BP_User_Query::__construct( string|array|null $query = null )
Constructor.
Description
Parameters
- $query
-
(Optional) See BP_User_Query.
Default value: null
Source
File: bp-core/classes/class-bp-user-query.php
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | public function __construct( $query = null ) { // Store the raw query vars for later access. $this ->query_vars_raw = $query ; // Allow extending classes to register action/filter hooks. $this ->setup_hooks(); if ( ! empty ( $this ->query_vars_raw ) ) { $this ->query_vars = wp_parse_args( $this ->query_vars_raw, array ( 'type' => 'newest' , 'per_page' => 0, 'page' => 1, 'user_id' => 0, 'search_terms' => false, 'search_wildcard' => 'both' , 'include' => false, 'exclude' => false, 'user_ids' => false, 'member_type' => '' , 'member_type__in' => '' , 'member_type__not_in' => '' , 'meta_key' => false, 'meta_value' => false, 'xprofile_query' => false, 'populate_extras' => true, 'count_total' => 'count_query' ) ); /** * Fires before the construction of the BP_User_Query query. * * @since BuddyPress 1.7.0 * * @param BP_User_Query $this Current instance of the BP_User_Query. Passed by reference. */ do_action_ref_array( 'bp_pre_user_query_construct' , array ( & $this ) ); // Get user ids // If the user_ids param is present, we skip the query. if ( false !== $this ->query_vars[ 'user_ids' ] ) { $this ->user_ids = wp_parse_id_list( $this ->query_vars[ 'user_ids' ] ); } else { $this ->prepare_user_ids_query(); $this ->do_user_ids_query(); } } // Bail if no user IDs were found. if ( empty ( $this ->user_ids ) ) { return ; } // Fetch additional data. First, using WP_User_Query. $this ->do_wp_user_query(); // Get BuddyPress specific user data. $this ->populate_extras(); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.7.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.