BP_Nouveau_Group_Invite_Query::get_group_member_ids()
Get the members of the queried group
Description
Return
(array) $ids User IDs of relevant group member ids
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;
}
$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'] );
if ( false === $this->query_vars['is_confirmed'] ) {
$sql['where'][] = $wpdb->prepare( 'is_confirmed = %d', (int) $this->query_vars['is_confirmed'] );
$sql['where'][] = 'inviter_id != 0';
}
// 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 $this->group_member_ids;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.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.