5

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.

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.

john
  • 349
  • 8
  • 15

2 Answers2

6

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 );
shanebp
  • 1,904
  • 3
  • 17
  • 28
1

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 );
Phyfey
  • 11
  • 1