Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List a member's groups on the Members Directory
function shanebp_user_groups(){
$group_ids = groups_get_user_groups( bp_get_member_user_id() );
foreach( $group_ids["groups"] as $id ) {
$group = groups_get_group( array( 'group_id' => $id ) );
echo '<a href=' . trailingslashit( bp_get_groups_directory_permalink() . $group->slug . '/' ) . '>' . $group->name . '<a/><br>';
}
}
add_action( 'bp_directory_members_item', 'shanebp_user_groups' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.