BuddyPress, get url (link) of a group using the group id

I’am getting the id of a group using:

$group = groups_get_group( array( 'group_id' => $id) );

But for the life of me I can’t figure out how to return the link to the group its self.

Read More

I can grab the slug, but some groups are sub groups so I can’t just:

echo 'domain/groups/'.$group->slug;

Any help greatly appreciated.

Related posts

2 comments

  1. Did you try:

    bp_get_group_permalink( $group );
    

    That will return the href value for the group.
    To get an html link use:

    bp_get_group_link( $group );
    
  2. For anyone still needing the answer to why bp_get_group_permalink( $group ); doesn’t work with just the group id, its because you need to create a Buddypress Group Object. Something like this:

        $group_obj = groups_get_group ( $group_id );
        $href = bp_get_group_permalink( $group_obj );
    

Comments are closed.