1
0
Fork 0
mirror of synced 2025-04-06 07:13:33 +03:00

Fix checking roles

This commit is contained in:
dima-uryvskiy 2021-08-03 17:01:54 +03:00
parent 021db64f79
commit e864277691

View file

@ -603,15 +603,15 @@ if (!class_exists('WC_Retailcrm_Customers')) :
$clientRoles = apply_filters('retailcrm_customer_roles', WC_Retailcrm_Plugin::clearArray($clientRoles));
if ($user instanceof WP_User) {
$userRole = empty($user->roles[0]) === false ? $user->roles[0] : null;
$userRole = !empty($user->roles[0]) ? $user->roles[0] : null;
} elseif ($user instanceof WC_Customer) {
$role = $user->get_role();
$userRole = empty($role) === false ? $role : null;
$userRole = !empty($role) ? $role : null;
} else {
return false;
}
return empty($clientRoles[$userRole]) === false;
return array_key_exists($userRole, $clientRoles);
}
}
endif;