Groups restrict Buddypress functions

Hello George,

I use Buddypress in my site and I’m looking for a way to restrict the different functions in BP, based on which Group the user is in.

For example, these functions would be available to users in the Group “Silver” and “Gold”, but not to those in Group “Bronze”:

BP groups – cannot see any existing groups or access them if user is “Bronze”. “Silver” user can only see some groups (it would be ideal if the restrictions can be set when creating or editing a BP group.)

Private Messages – cannot see any function of PM if user is “Bronze”.

Affliliates (your plugin) – no access to any affiliate functionality, or info in BP profile/menu, if user is “Bronze”.

User Blogs – cannot see or use if user is “Bronze”. (by BuddyBoss)

BP Documents – cannot see or use if user is “Bronze”. (BuddyPress Docs plugin)

Sitewide Activity Wall (by BuddyBoss) – cannot see or use if user is “Bronze”.

bbPress forums already have a good way of doing this with your premium plugin.

Is this a major job or can it be realised simply?

thanks for your assessment.

Stefano

Posted in

Comments

2 responses to “Groups restrict Buddypress functions”

  1. Thank you George!

  2. Hi Stefano,

    The quickest-simplest way to restrict content would be by using the following shortcode block:

    [groups_member group="Bronze"]
    Bronze members should upgrade their membership to view premium content.
    [/groups_member]
    [groups_member group="Gold"]
    Only members of the Gold group can see this.
    [/groups_member]

    This block can be used to restrict content in the affiliate area page. If the affiliate area page is not publicly accessible, then Affiliates functionality won’t be available to everyone.

    The same way, if the aforementioned plugins render functionality buttons/links to pages/posts where you can edit the content, you can use the blocks above and restrict content to specific groups.

    If this is not possible, then the plugins should be “pluggable” in order to interfere with normal process. By “pluggable” i mean if the plugins offer hooks to their functionality. If BP Documents for example offers a hook for creating a new document, then it’s feasible.
    Long story short, if we can hook to these functionalities, then we can add restrictions.

    Action/filter hooks is a feature of WordPress which gives the ability to interfere with the normal flow of code without modifying the actual code of a plugin or WordPress. A hook can allow you to do something else when something happens.
    For example, when a user becomes a member of the Gold group, remove the user from all the other groups. In this case we utilized the groups_created_user_group action.

    Kind regards,
    George

Share