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.
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 );
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 );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With