Skip to:
Content
Pages
Categories
Search
Top
Bottom

Number of groups limit


  • raep
    Participant

    @raep

    Hello,

    I would like to add a limit of groups that can be created.

    So if for example 70 groups has been created, no one can create a group anymore.

    How can I do that ?

    Thank you very much,

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

  • Venutius
    Moderator

    @venutius

    one option would be to use https://wordpress.org/buddypress-restrict-group-creation and limit the number of groups an individual can create.

    But for your main request, what you could do is simply wait till 70 groups are created and then turn off group creation for non admin.


    Venutius
    Moderator

    @venutius

    or:

    function bpex_user_can_create_groups( $can_create, $restricted ) {
    
    	$groups = groups_get_groups();
    
    	if ( $groups['total'] <= 70 )
    		return $can_create;
    
    	return false;
    }
    add_filter( 'bp_user_can_create_groups', 'bpex_user_can_create_groups', 99, 2 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar