Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] BP_Group_Extension For Single Group?

  • @coreymcollins

    Participant

    I’m using BP_Group_Extension to extend groups to include several pages, and everything is working fine. All of my pages display, the admin side works fine, etc. The issue is, I only want to add these new pages to one group – not every group on my site. How do I go about doing this? I don’t see anything mentioning this on the API guide here: http://codex.buddypress.org/developer/group-extension-api/

    And Googling hasn’t brought anything new to light.

    This is my Gist where I add the pages: https://gist.github.com/coreymcollins/c29f4a2e368e0627338d

    Is there anything here that I should be tweaking so the new pages apply to just one group?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @shanebp

    Moderator

    Which file are you using to load the extensions?

    If it’s a plugin, have you tried a simple include based on whether the group in question is being viewed?

    Maybe using something like:

    if ( bp_is_groups_component() && 'my-group' == bp_current_item() ) :

    @coreymcollins

    Participant

    I came across this post which helped a bit: https://buddypress.org/support/topic/conditional-bp_register_group_extension-how/

    I updated my gist above to reflect that, and I now have new pages added ONLY to the specific group ID I specified. Awesome!

    @shanebp

    Moderator

    Cool, a 4 year old thread that is still useful.

    minor stuff:
    You don’t need the $bp global
    I’d put the foreach in the ‘if ( $group_id == 1 )’ conditional

    I’m a bit surprised that it runs on ‘init’ rather than bp_loaded or bp_init because init seems very early – but the load order in some situations still surprises me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] BP_Group_Extension For Single Group?’ is closed to new replies.
Skip to toolbar