Skip to:
Content
Pages
Categories
Search
Top
Bottom

How To Show Groups That Only You (Or a User) Has Created (Not Joined)


  • David Bisset
    Participant

    @dimensionmedia

    I’m trying to modify things slightly so that the main groups tab only shows groups that the user has CREATED (not joined, as I believe is the default).

    I’ve looked at bp_has_groups (both the function in the code and the docs) and there aren’t any filters for this. I don’t have a problem duplicating functions just to add this, but this request doesn’t look straightforward to me. In fact, quite messy. I want to use BuddyPress’s functions and not create my own because of the built in pagination, etc. Any suggestions or recommendations?

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

  • Ron Rennick
    Participant

    @wpmuguru

    You could strip it down to just groups that the person is an admin of with

    `if( !bp_group_is_admin() ) { continue; }`

    However, that wouldn’t adjust your counts/pagination.


    David Bisset
    Participant

    @dimensionmedia

    Yeah, I thought of that – although I didn’t think of bp_group_is_admin so your way is better than mine – but the count/pagination is the killer. Actually, just the pagination is since I could come up with the count easily.

    Still playing around, though. Thanks Ron for helping me refine what I had.


    David Bisset
    Participant

    @dimensionmedia

    Followup: I have created a trac for this. Thanks to @boonebgorges and @pgibbs for the suggestion.

    interim – what about filtering on bp_has_groups and unset the items? (and readjust the count)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    `function new_group_is_admin_loop( $user_id = 0 ) {
    global $bp, $groups_template;

    if ( empty( $user_id ) )
    $user_id = $bp->loggedin_user->id;

    $groups_template = BP_Groups_Member::get_is_admin_of( $user_id );
    }`
    …or something similar? Untested so your mileage may vary.

    Chances are this won’t work, thinking back on it now. But, give it a shot. At the very least that function will return back the groups that the user is the admin of; you may need to do your own custom loop functions afterwards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Show Groups That Only You (Or a User) Has Created (Not Joined)’ is closed to new replies.
Skip to toolbar