BP_Groups_Member::get_group_member_ids( int $group_id )

Get the IDs of all a given group’s members.

Description

Parameters

$group_id

(Required) ID of the group.

Return

(array) IDs of all group members.

Source

File: bp-groups/classes/class-bp-groups-member.php

1129
1130
1131
1132
1133
1134
1135
public static function get_group_member_ids( $group_id ) {
    global $wpdb;
 
    $bp = buddypress();
 
    return array_map( 'intval', $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) ) );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.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.