Skip to content

Instantly share code, notes, and snippets.

@wpcrmsystem
Created August 30, 2016 19:48
Show Gist options
  • Save wpcrmsystem/1b535fce78b3d3d55b935f82938b281c to your computer and use it in GitHub Desktop.
Save wpcrmsystem/1b535fce78b3d3d55b935f82938b281c to your computer and use it in GitHub Desktop.
WP-CRM System Update Capabilities
/* Default User Roles
--------------------*/
add_filter( 'wpcrm_system_default_user_roles', 'wpcrm_system_check_user_roles', 10 );
function wpcrm_system_check_user_roles( $array ){
$array = array(
'subscriber',
'contributor',
'author',
'editor',
'administrator'
);
return $array;
}
/* Add the roles you'd like to administer contacts
------------------------------------------------*/
// Remove the original list of user roles
add_action( 'wpcrm_system_default_user_roles', 'change_user_roles', 1 );
function change_user_roles() {
remove_filter( 'wpcrm_system_default_user_roles', 'wpcrm_system_check_user_roles', 10 );
}
// Add your own user roles to the original list.
// Keep existing roles so they can be checked to see if they need to have the WP-CRM System capabilities removed .
add_filter( 'wpcrm_system_default_user_roles', 'my_user_roles', 1 );
function my_user_roles( $array ) {
$array = array(
'bbp_keymaster',
'subscriber',
'contributor',
'author',
'editor',
'administrator'
);
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment