woocommerce_shop_manager_editable_roles
woocommerce_shop_manager_editable_roles
Appears in: woocommerce.3.4.6, woocommerce.3.4.7, woocommerce.3.5.0, woocommerce.3.5.1, woocommerce.3.5.2, woocommerce.3.5.3, woocommerce.3.5.4, woocommerce.3.5.5, woocommerce.3.5.6, woocommerce.3.5.7, woocommerce.3.5.8, woocommerce.3.6.1, woocommerce.3.6.2, woocommerce.3.6.3, woocommerce.3.6.4, woocommerce.3.6.5, woocommerce.3.7.0, woocommerce.3.7.1, woocommerce.3.8.0, woocommerce.3.8.1, woocommerce.3.9.0, woocommerce.3.9.1, woocommerce.3.9.2, woocommerce.3.9.3, woocommerce.4.0.0, woocommerce.4.0.1, woocommerce.4.1.0, woocommerce.4.1.1, woocommerce.4.2.0, woocommerce.4.2.1, woocommerce.4.3.0, woocommerce.4.3.1, woocommerce.4.3.2, woocommerce.4.3.3, woocommerce.4.4.0, woocommerce.4.4.1, woocommerce.4.5.1, woocommerce.4.5.2, woocommerce.4.6.0, woocommerce.4.6.1, woocommerce.4.6.2, woocommerce.4.7.0, woocommerce.4.7.1, woocommerce.4.8.0, woocommerce.4.9.0, woocommerce.4.9.1, woocommerce.4.9.2, woocommerce.5.0.0, woocommerce.5.1.0, woocommerce.5.2.0, woocommerce.5.2.1, woocommerce.5.2.2, woocommerce.5.3.0, woocommerce.5.4.0, woocommerce.5.4.1, woocommerce.5.5.0, woocommerce.5.5.1, woocommerce.5.5.2, woocommerce.5.6.0, woocommerce.5.6.1, woocommerce.5.7.0, woocommerce.5.7.1, woocommerce.5.8.0, woocommerce.6.3.1, woocommerce.6.4.1, woocommerce.6.5.1, woocommerce.6.6.1, woocommerce.6.7.0, woocommerce.6.8.0, woocommerce.6.8.1, woocommerce.6.8.2, woocommerce.6.9.0, woocommerce.6.9.4, woocommerce.7.0.0, woocommerce.7.1.0, woocommerce.7.1.1, woocommerce.7.2.2, woocommerce.7.3.0, woocommerce.7.4.0, woocommerce.7.4.1, woocommerce.7.5.1, woocommerce.7.6.0, woocommerce.7.6.1, woocommerce.7.7.0, woocommerce.7.7.1, woocommerce.7.8.1, woocommerce.7.9.0, woocommerce.8.0.3, woocommerce.8.1.1, woocommerce.8.2.1, woocommerce.8.2.2, woocommerce.8.3.1, woocommerce.8.4.0, woocommerce.8.5.1, woocommerce.8.5.2, woocommerce.8.6.0, woocommerce.8.6.1, woocommerce.8.7.0, woocommerce.8.8.3, woocommerce.8.9.2, woocommerce.8.9.3, woocommerce.9.0.2, woocommerce.9.1.2, woocommerce.9.1.4, woocommerce.9.2.2, woocommerce.9.2.3, woocommerce.9.3.1, woocommerce.9.3.3, woocommerce.9.4.2, woocommerce.9.4.3, woocommerce.9.5.1
Hook Type: filter
Displaying hooks found in version: woocommerce.9.5.1apply_filters('woocommerce_shop_manager_editable_roles') is found 3 times:
- /includes/wc-rest-functions.php line 268
// Check to allow shop_managers to manage only customers.
if ( in_array( $context, array( ‘edit’, ‘delete’ ), true ) && wc_current_user_has_role( ‘shop_manager’ ) ) {
$permission = false;
$user_data = get_userdata( $object_id );
$shop_manager_editable_roles = apply_filters( ‘woocommerce_shop_manager_editable_roles’, array( ‘customer’ ) );if ( isset( $user_data->roles ) ) {
$can_manage_users = array_intersect( $user_data->roles, array_unique( $shop_manager_editable_roles ) );// Check if Shop Manager can edit customer or with the is same shop manager.
if ( 0 < count( $can_manage_users ) || intval( $object_id ) === intval( get_current_user_id() ) ) { [/php] - /includes/wc-user-functions.php line 623
if ( ! wc_current_user_has_role( 'administrator' ) ) { unset( $roles['administrator'] ); if ( wc_current_user_has_role( 'shop_manager' ) ) { $shop_manager_editable_roles = apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) ); return array_intersect_key( $roles, array_flip( $shop_manager_editable_roles ) ); } } return $roles; }
- /includes/wc-user-functions.php line 660
$caps[] = 'do_not_allow'; } elseif ( wc_current_user_has_role( 'shop_manager' ) ) { // Shop managers can only edit customer info. $userdata = get_userdata( $args[0] ); $shop_manager_editable_roles = apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment if ( property_exists( $userdata, 'roles' ) && ! empty( $userdata->roles ) && ! array_intersect( $userdata->roles, $shop_manager_editable_roles ) ) { $caps[] = 'do_not_allow'; } } } break;