Skip to:
Content
Pages
Categories
Search
Top
Bottom

Listing Groups user is admin or moderator of


  • rogerthat78
    Participant

    @rogerthat78

    Hey, all. I’m trying to create a custom Group loop that would show only the Groups that user is an admin or moderator of. I have basic knowledge of some functions, but I can’t wrap my head around how to write this check.

    I know of the `bp_group_is_admin()` and `bp_group_is_mod()` functions, but I’m not sure what that does exactly. Does it need the ID or slug to be passed through? How do I even begin to write that statement?

    For anyone willing to help, `bp_group_slug()` will get the Group’s slug within a loop, and `BP_Groups_Group::group_exists( bp_get_group_slug() )` will fetch the ID. I’m not aware of other ways to do this, so if this method is not efficient, please let me know.

    Thanks for any help.

Viewing 1 replies (of 1 total)
  • Retrieving groups based on current user’s role is a nice idea for a future enhancement for BuddyPress. Would you post such a ticket over on https://buddypress.trac.WordPress.org please? Use your username and password from this site.

    Doesn’t look like there is a nice way of doing this. Checking with those functions after-the-fact will mess up any pagination you may use, or zebra striping, or things like that.

    In your bp_has_groups(), be sure to set the ‘user_id’ parameter if you are doing this outside of the profile page area. This will limit the query to only groups that the specified member has joined. Then put something like this in your bp-custom.php file (not tested, but should point you in the right direction): http://pastebin.com/ceJgyWLT

Viewing 1 replies (of 1 total)
  • The topic ‘Listing Groups user is admin or moderator of’ is closed to new replies.
Skip to toolbar