Restrict shop managers to editing customers

This commit is contained in:
claudiulodro 2018-09-14 12:08:36 -07:00
parent b9c364a475
commit d6144a769e
1 changed files with 5 additions and 0 deletions

View File

@ -379,6 +379,11 @@ function wc_modify_map_meta_cap( $caps, $cap, $user_id, $args ) {
if ( user_can( $args[0], 'administrator' ) && ! current_user_can( 'administrator' ) ) { if ( user_can( $args[0], 'administrator' ) && ! current_user_can( 'administrator' ) ) {
$caps[] = 'do_not_allow'; $caps[] = 'do_not_allow';
} }
// Shop managers can only edit customer info.
if ( current_user_can( 'shop_manager' ) && ! user_can( $args[0], 'customer' ) ) {
$caps[] = 'do_not_allow';
}
} }
break; break;
} }