PHP-Auth
PHP-Auth copied to clipboard
How to set status of users?
Is it possible to update/set the status (locked, suspended, pending review etc) of a user by the admin? I couldn't find a method to do so.
Thanks for your feedback!
You are right, there’s indeed no method in the Administration
interface yet that allows you to do that. Sorry! We should definitely add this in the future.
Until then, changing the status should still be as easy as executing the custom SQL query
UPDATE users SET status = ? WHERE id = ?
with the first parameter being one of the values
\Delight\Auth\Status::NORMAL;
\Delight\Auth\Status::ARCHIVED;
\Delight\Auth\Status::BANNED;
\Delight\Auth\Status::LOCKED;
\Delight\Auth\Status::PENDING_REVIEW;
\Delight\Auth\Status::SUSPENDED;
and the second parameter being the user ID, which can be accessed like this:
$auth->getUserId();
Hope that helps!
Thanks
No problem!
By the way, let’s keep this issue open, so that we know we have to implement this in the future.
Bumping this old thread and vouching for function that allows user status manipulation :) . Thank you Ocram!