You need to clarify your question.
You want a link to go to ‘My Groups’ – does that mean the Groups page on their profile that shows all the Groups they belong to?
Or a link that goes directly to a single Group ? Assuming they only belong to one group.
Or… ?
You may want to share your header code by using gist and then posting the link here.
That way we can see the exact context.
Thank you for your reply.
Actually, I have a button “My group” and a none display bloc where I put this code, and a jquery shows all my groups on clic :
<?php
$group_ids = groups_get_user_groups(bp_displayed_user_id());
foreach($group_ids["groups"] as $group_id) {
echo('<a title="Aller sur le groupe" href="' . home_url() . '/groupes/' . groups_get_group(array( 'group_id' => $group_id )) -> slug . '">' .groups_get_group(array( 'group_id' => $group_id )) -> name . '</a>' . (end($group_ids["groups"]) == $group_id ? '' : ', ' ) ); }
?>
So this code is working on my profile page, I have all my groups. On a group page, only the group where I am shows, and everywhere else there is no list.
So do you have an idea to show a list of “my group” everywhere?
Thank you a lot !
bp_displayed_user_id()
only works on a profile page – the displayed user.
Try using bp_loggedin_user_id()
It’s working !! Your f***ing so strong 🙂 You saved my week !
Thank you a lot