Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP only for Role: Contributor and above

  • @chiefalchemist

    Participant

    I have a situation where the BP part of the site / application is only for select users (read: employees).

    That said, we only want the staff employees using the BP magic. They won’t be editing posts, etc.

    Should I add a new Role and have a cap (say) ’employee”? Or remove caps from the Contributor role? And then maybe still add the ’employee’ cap to all other roles, such that Subscribers can still comment and get the plain ol’ WP experience, and then I’ll use the use_can(’employee’) to allow them into the BP functionality?

    I presume I’m also gonna need a membership plugin to manage the access. Is there any one in particular that is known to play nice with BP (if that ever might be an issue). Or is the bottleneck in BP that I can take advantage of that keep non use_can(’employee’) out of the employee / BP area?

    Thanks again.

    Lovin’ me some BP, but there’s just soooo much to wrap my head around sometimes 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • @henrywright

    Moderator

    Hi @chiefalchemist,

    Should I add a new Role and have a cap (say) ‘employee”? Or remove caps from the Contributor role?

    Both are completely valid approaches but perhaps creating an ’employee’ role with custom capabilities would make more sense?

    Regarding the use of a membership plugin, you could go down that route, else the current_user_can() and user_can() functions will help if you decide to use custom code.

    Refs:

    @chiefalchemist

    Participant

    Thanks @henrywright

    I’ve mucked around with Roles and Caps here and there previously, but not in the context of BP.

    I realize there’s a couple ways, I was just curious about best practices, and which membership plugin is a known for using with BP (as opposed to something that’s crap w/ BP).

    Finally, is there a snippet I can put somewhere so that it’s easy to allow / prevent BP access – as opposed to doing something in multiple pages. I’m a BP n00b. This is my first true project with it so I’m still coming to terms with architecture, how it thinks, etc.

    So type slowly so I don’t miss anything thing. Thanks. 😉

    @henrywright

    Moderator

    I’m not sure which membership plugins work well with BP as I’ve not used any but I’m sure some of the guys on here will be able to recommend?

    As @r-a-y points out in this thread, is_buddypress() is a good catch all for BuddyPress pages. So, you could put something like this in your theme’s functions.php file:

    function my_function() {
        if ( is_buddyPress() ) {
            // This is a BuddyPress page you are viewing so do something BuddyPressy.
        } else {
            // This is not a BP page.
        }
    }
    add_action( 'init', 'my_function' );

    @chiefalchemist

    Participant

    Thanks again @henrywright.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘BP only for Role: Contributor and above’ is closed to new replies.
Skip to toolbar