BP_Group_Member_Query::get_include_ids( array $include = array() )
Get a list of user_ids to include in the IN clause of the main query.
Description
Overrides BP_User_Query::get_include_ids(), adding our additional group-member logic.
Parameters
- $include
-
(Optional) Existing group IDs in the $include parameter, as calculated in BP_User_Query.
Default value: array()
Return
(array)
Source
File: bp-groups/classes/class-bp-group-member-query.php
public function get_include_ids( $include = array() ) { // The following args are specific to group member queries, and // are not present in the query_vars of a normal BP_User_Query. // We loop through to make sure that defaults are set (though // values passed to the constructor will, as usual, override // these defaults). $this->query_vars = bp_parse_args( $this->query_vars, array( 'group_id' => 0, 'group_role' => array( 'member' ), 'is_confirmed' => true, 'invite_sent' => null, 'inviter_id' => null, 'type' => 'last_joined', ), 'bp_group_member_query_get_include_ids' ); $group_member_ids = $this->get_group_member_ids(); // If the group member query returned no users, bail with an // array that will guarantee no matches for BP_User_Query. if ( empty( $group_member_ids ) ) { return array( 0 ); } if ( ! empty( $include ) ) { $group_member_ids = array_intersect( $include, $group_member_ids ); } return $group_member_ids; }
Changelog
Version | Description |
---|---|
BuddyPress 1.8.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.