is there a way to disable creating private groups

is there a way to disable creating private groups in buddypress for users?

  • Vaughan

    Hi Sam,

    Hope you're well?

    Not sure if this way still works with latest BP, but it did before, the last time I tried it.

    create a file called bp-custom.php

    Then add the following code to this file.

    <?php
    function wpmu_disable_group_status($stati) {
        if($key = array_search(‘hidden’, $stati)) {
            unset($stati[$key]);
        }
        return $stati;
    }
    add_filter(‘groups_valid_status’, ‘wpmu_disable_group_status’);

    Then upload the bp-custom.php file to your /wp-content/plugins folder using FTP.

    Hope this helps

  • Hoang Ngo

    Hi @Sam,

    I hope you are well today.

    For disable users can create private group, first please add this code to your theme functions.php or use mu-plugins

    add_filter('groups_allowed_status', 'groups_allowed_status_ex');
    function groups_allowed_status_ex($status)
    {
        if ($key = array_search('private', $status)) {
            unset($status[$key]);
        }
        return $status;
    }

    And next, we will need to create a custom template for the create new group screen. Please create a folder called "groups" on your theme, and you need to copy the file /buddypress/bp-themes/bp-default/groups/create.php to your recent created folder.

    In the create.php file you've just copied, line 70 - 77, you will see a code block like this

    <label><input type="radio" name="group-status" value="private"<?php if ( 'private' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
    							<strong><?php _e( 'This is a private group', 'buddypress' ); ?></strong>
    							<ul>
    								<li><?php _e( 'Only users who request membership and are accepted can join the group.', 'buddypress' ); ?></li>
    								<li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ); ?></li>
    								<li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ); ?></li>
    							</ul>
    						</label>

    Please remove it, that action will remove the option create private group, hope that will help :slight_smile:

    If you have any issues please don't hesitate to let us know so we can assist.

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.