Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Groups or activating different plugins in different groups?


  • phos flip
    Participant

    @wamoma

    I’ve searched all over for ways to do this but had no luck. Probably I’m looking for the wrong things so hoping somebody could gently point me in the right direction?

    I want to set up groups that do different things, for example:

    Group 1: has a forum and a gallery
    Group 2: has forum, gallery, events and a blog

    I thought the way to do this would either be to set up some groups with custom tabs but I got stuck on how to make this work with plugins.

    Another option was maybe to hide certain plugins on certain groups but this seems a bit messy and I’m not sure how I’d do and would it cause complications as the site grows.

    Or maybe an option for group admins or maybe the site admin to be able to specify which plugins appear in which groups. This doesn’t seem to be an option though so maybe I need to look at creating some sort of plugin to make this happen? If so I’m not a coder, I mostly just hack at other peoples stuff, but I’m happy to give it a go if people could suggest how best to go about?

    Any suggestions are most appreciated

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

  • Bowe
    Participant

    @bowromir

    A while back I asked MrMaz (core developer) to look into this and by using the Group extension API to control this.. Long story short he came to the conclusion that it was nearly impossible to integrate this with the Group API without hacking up the core. Currently I have different Group Types working, but they all need to have the same plugins and thus creation procedure.


    Boone Gorges
    Keymaster

    @boonebgorges

    (Sorry in advance that this answer is full of code. There is currently no easy way to do what you want to do, though with some coding it can be done pretty easily.)

    Plugins generally create new group tabs through the BP Group Extension API: https://codex.buddypress.org/developer-docs/group-extension-api/ So a relatively quick way to keep certain tabs from appearing on certain groups is to modify the enable_nav_item() method, as shown under ‘Advanced Usage’ on that page. You’d have to do this to the plugins themselves.

    If you’d prefer not to modify the plugins (which would be quite understandable) you could remove nav items after the fact with bp_core_remove_subnav_item(), defined in bp-core.php. This would take a lot of tweaking (and this is totally untested, so you’d have to experiment) but something in bp-custom.php like the following might work for you:

    `function boone_limit_gallery_visibility() {
    global $bp;

    if ( !groups_get_groupmeta( $bp->groups->current_group->id, ‘show_gallery’ ) )
    bp_core_remove_subnav_item( ‘groups’, ‘gallery’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_limit_gallery_visibility’, 999 );`

    This assumes a couple things: 1) that your gallery plugin uses the term ‘gallery’ to name the subnav item, and 2) that you have already created a piece of group metadata ‘show_gallery’ for all groups that should see the gallery. You could also hardcode an array of group ids, like so:

    `function boone_limit_gallery_visibility() {
    global $bp;

    $gallery_array = array( 3, 6, 10, 12, 14 );

    if ( !in_array( $bp->groups->current_group->id, $gallery_array) )
    bp_core_remove_subnav_item( ‘groups’, ‘gallery’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_limit_gallery_visibility’, 999 );`

    That might be easier to get up and running at first, while you build the markup and functions necessary to save groupmeta.


    phos flip
    Participant

    @wamoma

    no need to apologise – very much appreciated! I’ll give that a go & report back, many thanks


    phos flip
    Participant

    @wamoma

    looks as though the membership plugin here:

    http://premium.wpmudev.org/project/membership

    has the functionality I’m after. Seems like an absolute rip off signing up to that site though!


    phos flip
    Participant

    @wamoma

    hm – just tried the lite version of that plugin and doesn’t do anything at all. I see somebody else has mentioned the same on the plugin page.

    Also see that the person apparently singing it’s praises appears to work for them – given she was told 2 days ago it wasn’t working and how much they charge for the fully functional version I’d have thought they’d have pretty quick to respond!

    I’m curious too how it’s somehow obtained 11 full star ratings already when seemingly it doesn’t work?!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Groups or activating different plugins in different groups?’ is closed to new replies.
Skip to toolbar