Skip to content

Instantly share code, notes, and snippets.

@modemlooper
Last active December 27, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modemlooper/7346170 to your computer and use it in GitHub Desktop.
Save modemlooper/7346170 to your computer and use it in GitHub Desktop.
// blocks changing group type on edit screen
function bp_block_private_groups_edit( $status ) {
//no restriction to site admin
if ( !is_super_admin() ) {
$status = array( 'public' );
}
return $status;
}
add_filter( 'groups_allowed_status', 'bp_block_private_groups_edit' );
// blocks changing group type on group creation
function bp_block_private_groups_create( $group_id ) {
//no restriction to site admin
if ( !bp_is_group_create() || is_super_admin() )
return false;
if ( !current_user_can('manage_options') ) {
groups_edit_group_settings( $group_id, $enable_forum, 'public', $invite_status );
}
}
add_action( 'groups_group_create_complete', 'bp_block_private_groups_create' );
add_action( 'groups_created_group', 'bp_block_private_groups_create' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment