PHP-Auth icon indicating copy to clipboard operation
PHP-Auth copied to clipboard

How to set status of users?

Open ianchlee opened this issue 6 years ago • 4 comments

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.

ianchlee avatar Apr 25 '18 08:04 ianchlee

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!

ocram avatar Apr 25 '18 16:04 ocram

Thanks

ianchlee avatar Apr 26 '18 07:04 ianchlee

No problem!

By the way, let’s keep this issue open, so that we know we have to implement this in the future.

ocram avatar Apr 26 '18 15:04 ocram

Bumping this old thread and vouching for function that allows user status manipulation :) . Thank you Ocram!

ponasromas avatar Oct 10 '20 17:10 ponasromas