Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display groups of connected member


  • AliceG
    Participant

    @aliceg

    Hello!
    I just found this link to solve my problem but, it work only on a group page!
    I made a header on my site, where user can see their notifications, their new message notification and I would like to add “my groups” button. Else, we have to go to “all groups” page, charge, waiting and find our group… (there is 40 groups…)
    So is there a way to display these groups link ?
    You would save me !
    Thank you a lot for your answer…

Viewing 4 replies - 1 through 4 (of 4 total)

  • shanebp
    Moderator

    @shanebp

    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.


    AliceG
    Participant

    @aliceg

    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 !


    shanebp
    Moderator

    @shanebp

    bp_displayed_user_id() only works on a profile page – the displayed user.

    Try using bp_loggedin_user_id()


    AliceG
    Participant

    @aliceg

    It’s working !! Your f***ing so strong 🙂 You saved my week !
    Thank you a lot

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar