BP_Nouveau_Group_Invite_Query::get_group_member_ids()
Get the members of the queried group
Description Description
Return Return
(array) $ids User IDs of relevant group member ids
Source Source
File: bp-templates/bp-nouveau/includes/groups/classes.php
protected function get_group_member_ids() { global $wpdb; if ( is_array( $this->group_member_ids ) ) { return $this->group_member_ids; } // Fetch **all** invited users. $pending_invites = groups_get_invites( array( 'item_id' => $this->query_vars['group_id'], 'invite_sent' => 'sent', 'fields' => 'user_ids' ) ); // This is a clue that we only want the invitations. if ( false === $this->query_vars['is_confirmed'] ) { return $pending_invites; } /** * Otherwise, we want group members _and_ users with outstanding invitations, * because we're doing an "exclude" query. */ $bp = buddypress(); $sql = array( 'select' => "SELECT user_id FROM {$bp->groups->table_name_members}", 'where' => array(), 'orderby' => '', 'order' => '', 'limit' => '', ); /** WHERE clauses *****************************************************/ // Group id $sql['where'][] = $wpdb->prepare( 'group_id = %d', $this->query_vars['group_id'] ); // Join the query part $sql['where'] = ! empty( $sql['where'] ) ? 'WHERE ' . implode( ' AND ', $sql['where'] ) : ''; /** ORDER BY clause ***************************************************/ $sql['orderby'] = 'ORDER BY date_modified'; $sql['order'] = 'DESC'; /** LIMIT clause ******************************************************/ $this->group_member_ids = $wpdb->get_col( "{$sql['select']} {$sql['where']} {$sql['orderby']} {$sql['order']} {$sql['limit']}" ); return array_merge( $this->group_member_ids, $pending_invites ); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |