Skip to:
Content
Pages
Categories
Search
Top
Bottom
Codex HomeDeveloper ResourcesAction Reference → Groups

Groups

bp-groups.php

bp-groups/bp-groups-templatetags.php

bp-groups/directories/bp-groups-directory-groups.php

Accessing Group Info by ID

If you want to access the BuddyPress group info without calling an action or without going through an entire loop, you can use the following code:

$group = new BP_Groups_Group( $group_id );

In order to get the HTML code for the group avatar image using the Group ID, you can use the following code:

$avatar = bp_core_fetch_avatar( array( 'item_id' => $group_id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height ) );

$group_id is the variable you’ll need to pass in to get the avatar for that group. You can also change the type variable to ‘type’ => ‘thumb’ to get the thumbnail version of the avatar.

Skip to toolbar