Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Restricting group creation to admins


Simon Wheatley
Participant

@simonwheatley

The plugin is proof of concept code, you need to decide under what circumstances you want to allow group creation. At the moment, as you say, everyone is restricted… perhaps you want to base it on user capabilities? Have a look at the WordPress function current_user_can (support forum tag) and use this in rgc_validate_group_creation something like this (untested):

// Stop the creation of a group unless the current user can manage options

function rgc_validate_creation( $allowed, $group_details ) {

// User is OK to continue if they can manage options

if ( current_user_can( 'manage_options' ) )

return true;

// Otherwise they can't

bp_core_add_message( 'Sorry, you are not allowed to create groups.', 'error' );

return false;

}

Skip to toolbar