Hello all i was wondering if someone could help me out. I would like to add a cap to the woocommerce shop manager role. I found this function but it will not work.
function add_capability() {
// gets the author role
$role = get_role( 'shop_manager' );
// This only works, because it accesses the class instance.
$role->add_cap( 'add_new_user' );
}
add_action( 'admin_init', 'add_capability');
any one know of a solution i would really appreciate it.
As per the current list of capabilities, there's no capability called add_new_user
. See the following link : http://codex.wordpress.org/Roles_and_Capabilities#Capabilities .
The correct capability to add is create_users
, once the capability is added, the option appears under Profile -> Add New User
function add_capability() {
// gets the author role
$role = get_role( 'shop_manager' );
// This only works, because it accesses the class instance.
$role->add_cap( 'create_users' );
}
add_action( 'admin_init', 'add_capability');