How do I activate a user account via console?

I need to activate a user via console so that they do not have to click on the activation link in an email. What would be the commands in console to do so?

Old methods found in older topics do not seem to work anymore.

I don’t think there is a direct command for that, but you can use the Rails console.
First, you enter into it:

cd /var/discourse
./launcher enter app
rail c

Then, you find the user by its username (replace username_to_activate) and activate it.

User.find_by(username: "username_to_activate").activate

You can type exit two times to quit.

You should see that action in the log:

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.