BP_Groups_Group::get_total_member_count( int $group_id )

Get the member count for a group.

Description

Parameters

$group_id

(Required) Group ID.

Return

(int) Count of confirmed members for the group.

Source

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

1728
1729
1730
1731
1732
1733
1734
public static function get_total_member_count( $group_id ) {
    global $wpdb;
 
    $bp = buddypress();
 
    return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(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.