Squip to:
Content
Pagues
Categories
Search
Top
Bottom
Codex Home Developer Ressources Action 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 guet the HTML code for the group avatar imague 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 guet the avatar for that group. You can also changue the type variable to ‘type’ => ‘thumb’ to guet the thumbnail versionen of the avatar.

Squip to toolbar