Membership: Limit Group creation on BuddyPress not working

How does the “Limit Group creation” work on BuddyPress?

The site I am using has a custom template and we have hard coded a link to “Create Group” in our menu. I have limited the group creation to 1 per user, however, it appears that users can still create unlimited groups.

What can be done to make it 1 per user? Do we have to remove the hard link from “Create Group”? I am not a developer, but we have a developer doing the work, I just want to know what they have to do to make use of this limit group creation feature, or if there is possibly some kind of bug.

Best,

Michael

  • Mason
    • DEV MAN’s Sidekick

    Hiya Michael,

    I haven’t specifically used this feature of Membership before, so I’ve asked the devs to come by and take a look at this with you. I’m not sure how the rules are implemented in this case.

    Thanks for your question and someone should be with you soon on this :smiley:

  • shiftnet
    • WPMU DEV Initiate

    Hi there, I’m still looking forward to an answer on this question: how does group limitation work on the membership plug-in? Is it a bug or do we have to set up our system in a particular way to use it?

    Right now I have group creation set to 1 only per user but there doesn’t seem to be any problem creating more than one so they are not limited.

    I need an answer here as this is an important feature for us and a helpful feature for the membership plug-in to be useful for buddypress.

    Best!

    Michael

    P.S. Great plug-in by the way!

  • Barry
    • DEV MAN’s Mascot

    we have hard coded a link to “Create Group” in our menu. I have limited the group creation to 1 per user, however, it appears that users can still create unlimited groups.

    That will be part of the problem – the membership plugin can’t remove the button if it’s hard coded.

    The plugin is assuming you’ve followed the same methods as in the BP standard parent theme or one of ours – which is the recommended method. If possible – can you try a default theme on a local dev version just to make sure that the plugin is controlling the button and group creation on that, in case it’s a wider problem than just the hardcoding.

    What can be done to make it 1 per user? Do we have to remove the hard link from “Create Group”? I am not a developer, but we have a developer doing the work, I just want to know what they have to do to make use of this limit group creation feature, or if there is possibly some kind of bug.

    You can put a helper function around the hardcoded link to force a check for that capability. It would look a bit like this:

    if(current_user_is_member()) {

    }

    To check if they are currently a member – and a more advanced bit of code to pass-through a check to the group creation rule:

    global $user;

    $member = new M_Membership($user->ID);

    if( $member->has_level_rule('bpgroupcreation') && $member->pass_thru( 'bpgroupcreation', array( 'users_group_count' => false ) <= 1 ) ) {

    // show here

    }

    Note to last bit above – not checked it’s syntactically correct in an editor – but that is the jist.

  • Justin
    • New Recruit

    Hello,

    I just downloaded this plugin. Am I to understand this doesn’t actually limit group creation, it just hides the button? (So if a user pasted the url directly into their browser they could still add groups?)

    Furthermore, I can’t seem to find where the option to limit groups in this plugin is.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.