forbid admin user on frontend
This commit is contained in:
@@ -166,6 +166,12 @@ class Wiaas_Authentication {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static function authenticate_rest_user_on_login($data, $user) {
|
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,
|
||||||
|
));
|
||||||
|
}
|
||||||
$role = user_can($user->ID, 'wiaas_customer') ? 'customer' : '';
|
$role = user_can($user->ID, 'wiaas_customer') ? 'customer' : '';
|
||||||
$user->set_role($role);
|
$user->set_role($role);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user