Skip to:
Content
Pages
Categories
Search
Top
Bottom

getting array of all groups

  • Avatar of mort3n
    mort3n
    Participant

    @mort3n

    Hi,

    I need to list all (public) groups and all members on a subpage of the user profile page.

    The listing of all members have already been addressed in a previous thread on this site, but I can’t seem to find a way to list all groups.

    The Codex specifies the function bp_groups(). Using this however only gets the groups that the current user is a member of.

    Any suggestions?

    Cheers
    Mort3n

    EDIT:
    pip if ( bp_has_groups() ) :

    my heading

    pip while ( bp_groups() ) : bp_the_group();
    pip if( ‘public’ == bp_get_group_status() ) {
    <input type=checkbox name="groups[]" value=" pip bp_group_id(); " pip bp_group_name();

    pip }
    pip endwhile;
    pip endif;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    You can set the parameters of which groups to get within `bp_has_groups`. One of the arguments, `user_id`, defaults to the displayed user. Setting `user_id` to false should do the trick:
    `bp_has_groups( array( ‘user_id’ => false ) )`

    Avatar of ripulkr
    ripulkr
    Participant

    @ripulkr

    use this:

    $vgroups = $groups = BP_Groups_Group::get(array(
    							'type'=>'alphabetical',
    							'per_page'=>999
    							));
    						print_r($vgroups);
Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.