allow admin on frontend

This commit is contained in:
Almira Krdzic
2018-10-22 11:00:48 +02:00
parent 790d24a1f6
commit 09aac81276

View File

@@ -47,7 +47,7 @@ class Wiaas_Authentication {
*/
public static function authenticate_current_user($user_id) {
// do nothing if user not authenticated, user is super admin or this is REST API request
if (! $user_id || $user_id === self::SUPER_ADMIN_USER_ID) {
if (! $user_id || (int) $user_id === self::SUPER_ADMIN_USER_ID) {
return $user_id;
}
@@ -168,9 +168,7 @@ class Wiaas_Authentication {
public static function authenticate_rest_user_on_login($data, $user) {
// if admin do nothing
if ($user->ID === self::SUPER_ADMIN_USER_ID) {
return new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array(
'status' => 403,
));
return $data;
}
$role = user_can($user->ID, 'wiaas_customer') ? 'customer' : '';
$user->set_role($role);