Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

Template Tag ”is_user_in_group()” ??? (4 posts)

Started 1 year, 6 months ago by: Nepf

  • Profile picture of Nepf nepf said 1 year, 6 months ago:

    I’m creating a new theme.
    I want to display something in the sidebar only to members of a certain group.

    Is there a template tag, something like “is_user_in_group(‘cats’)” ???

  • Profile picture of rich! @ etiviti rich! @ etiviti said 1 year, 6 months ago:
    function groups_is_user_member( $user_id, $group_id )
  • Profile picture of Nepf nepf said 1 year, 6 months ago:

    thank you

  • Profile picture of techguy techguy said 1 year, 6 months ago:

    Since you saved me the time looking for this, I’ll throw in the other 2 I already knew:
    groups_is_user_mod( $bp->loggedin_user->id, $bp->groups->current_group->id)
    groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id)

    Plus, that’s the code to get the logged in userid and current groupid.