[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-user-query.php (summary)

Core component classes.

File Size: 845 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BP_User_Query:: (8 methods):
  __construct()
  setup_hooks()
  prepare_user_ids_query()
  do_user_ids_query()
  do_wp_user_query()
  get_include_ids()
  populate_extras()
  get_sql_clause_for_member_types()


Class: BP_User_Query  - X-Ref

BuddyPress User Query class.

Used for querying users in a BuddyPress context, in situations where WP_User_Query won't do the trick:
Member directories, the Friends component, etc.

__construct( $query = null )   X-Ref
Constructor.

since: 1.7.0
param: string|array|null $query See {@link BP_User_Query}.

setup_hooks()   X-Ref
Allow extending classes to set up action/filter hooks.

When extending BP_User_Query, you may need to use some of its
internal hooks to modify the output. It's not convenient to call
add_action() or add_filter() in your class constructor, because
BP_User_Query::__construct() contains a fair amount of logic that
you may not want to override in your class. Define this method in
your own class if you need a place where your extending class can
add its hooks early in the query-building process. See
{@link BP_Group_Member_Query::setup_hooks()} for an example.

since: 1.8.0

prepare_user_ids_query()   X-Ref
Prepare the query for user_ids.

since: 1.7.0

do_user_ids_query()   X-Ref
Query for IDs of users that match the query parameters.

Perform a database query to specifically get only user IDs, using
existing query variables set previously in the constructor.

Also used to quickly perform user total counts.

since: 1.7.0

do_wp_user_query()   X-Ref
Use WP_User_Query() to pull data for the user IDs retrieved in the main query.

since: 1.7.0

get_include_ids( $include = array()   X-Ref
Fetch the IDs of users to put in the IN clause of the main query.

By default, returns the value passed to it
($this->query_vars['include']). Having this abstracted into a
standalone method means that extending classes can override the
logic, parsing together their own user_id limits with the 'include'
ids passed to the class constructor. See {@link BP_Group_Member_Query}
for an example.

since: 1.8.0
return: array The list of users to which the main query should be
param: array $include Sanitized array of user IDs, as passed to the 'include'

populate_extras()   X-Ref
Perform a database query to populate any extra metadata we might need.

Different components will hook into the 'bp_user_query_populate_extras'
action to loop in the things they want.

since: 1.7.0

get_sql_clause_for_member_types( $member_types, $operator )   X-Ref
Get a SQL clause representing member_type include/exclusion.

since: 2.4.0
return: string
param: string|array $member_types Array or comma-separated list of member types.
param: string       $operator     'IN' or 'NOT IN'.



Generated: Tue Oct 15 01:00:54 2024 Cross-referenced by PHPXref 0.7.1