Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get the current group slug

  • @johnnymestizo

    Participant

    Hi

    I am trying to get the current group slug. I am using BP Group Hierarchy.

    Not the permalink (which is the url all after the main domain).
    bp_get_current_group_slug();

    Not the name.
    bp_get_current_group_name();

    Any ideas?

    Cheers

    Johnny

Viewing 9 replies - 1 through 9 (of 9 total)
  • @djpaul

    Keymaster

    That’ll probably only work when used inside a Groups template loop. Where are you putting this?

    @johnnymestizo

    Participant

    Also do not want the groups component url/slug either :)

    @johnnymestizo

    Participant

    inside a groups sub nav tab. so that should be in the groups template loop.

    any ideas?

    Johnny

    @johnnymestizo

    Participant

    So, inside a group template, how do you get the current group slug?

    Thanks,

    Johnny

    @boonebgorges

    Keymaster

    bp_get_current_group_slug() gets the slug for the current viewed group ($bp->groups->current_group->slug). For instance, in this group, it would return
    `how-to-and-troubleshooting`

    bp_get_group_slug() gets the slug of the group when you’re inside of a group loop ($groups_template->group->slug).

    @johnnymestizo

    Participant

    BAM !!!!!!!!!

    bp_get_current_group_slug()

    thanks

    Johnny

    @johnnymestizo

    Participant

    crap.

    This is the same problem. When running BP Group Hierarchy the function bp_get_current_group_slug() actually returns the slug for the hierarchy and the current group.

    ie: development/public/modded-splog

    I just want modded-splog

    Is this possible?

    BTW bp_get_current_group_slug() does return the correct slug when the group is root (not a sub group when BP Group Hierarchy is used).

    Cheers,

    Johnny

    @johnnymestizo

    Participant

    @ddean

    Any ideas on how to return the current group slug only. not the rest of the hierarchy?

    Cheers

    Johnny

    @johnnymestizo

    Participant

    As this is not being looked at I have re created the topic under the BP Group Hierarchy plugin forum.

    https://buddypress.org/community/groups/bp-group-hierarchy/forum/topic/function-to-return-current-group-slug-even-if-in-group-sub-levels/

    Johnny

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to get the current group slug’ is closed to new replies.
Skip to toolbar