Skip to:
Content
Pages
Categories
Search
Top
Bottom

List of Group Member IDs

  • @enda77

    Participant

    I’m trying to return a comma separated list of all the member ids in a particular group. I’m using the bp_group_has_members() but I cant get it to work. It just returns ‘1’ for every group.

    $group_id = bp_get_group_id();
    $group_members = bp_group_has_members($group_id);
    echo $group_members;

    Could anyone help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @danbp

    Participant

    The first part of this topic gives a solution for your question:
    https://buddypress.org/support/topic/access-xprofile-field-data-in-a-custom-page/

    @shanebp

    Moderator

    Try, after while ( bp_groups() ) : bp_the_group(); :

    $args = array( 
        'group_id' => bp_get_group_id(),
        'exclude_admins_mods' => false
    );
    
    $group_members_result = groups_get_group_members( $args );
    $group_members = array();
    
    foreach(  $group_members_result['members'] as $member ) {
    	$group_members[] = $member->ID;
    }
     
    echo implode(", ", $group_members);
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar