In particular cases, it can be useful to add a user roles group cloned.
As you know the default groups in Worpress are Administrator, Editor, Author, Contributor, Subscriber.
Woocommerce adds the following: Shop manager and Customer.
The following code lets you create a new User Roles group base on cloning the customer roles:
1 2 3 4 5 6 7 8 9 10 11 12 | //AGGIUNGERE RUOLO add_action( 'init' , 'cloningcustomer' ); function cloningcustomer() { global $wp_roles ; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); $adm = $wp_roles ->get_role( 'customer' ); $wp_roles ->add_role( 'business_user' , 'Business User' , $adm ->capabilities); } |
Questions? Suggestions? Please leave a comment below.