How can I change user primary email?

AI-generated summary

The discussion revolves around changing a user’s primary email address as an administrator on a Discourse platform. pfaffman explains that the email can be changed via the user’s profile page, but verification is required, and suggests using the Rails console for direct changes, which is safer than database queries. However, evantill notes they cannot use the console since they are hosted on trydiscourse.com. evantill clarifies that the email field isn’t editable on the profile page, but hawm points out that impersonation allows access to the email field. evantill confirms this workaround but notes the inconvenience of logging out after impersonation. hawm shares a link to a feature request for a ‘stop impersonating’ option. pfaffman suggests deleting the account if the email isn’t verified, which evantill agrees to try, thanking hawm for the link.

As an administrator, how can I change a user email address ?

There are many topics discussing this. You can visit the user’s profile page and change it but they’ll still need to verify their address, which is almost always a good idea.

If you want to take matters into your own hands, you can do it from the rails console. It’s much safer than direct database queries.

This might work

u=User.find_by_username("pat") 
UserEmail.find_by(user_id: u.id).first.update (email: "pat@gmail.com")


I can not use the console has we are hosted on trydiscourse.com.

What do you mean by visiting ? If I go to the user page as an administrator, I can edit username and name for example but not the email.

Scroll down to bottom then you will see an impersonation button if your as an admin

Yes indeed, it’s how I do it now. But after impersonation, I need to logout to go back to my administrator account. I hoped there was a better way.

Seems no possible for now

Oh. The email isn’t verified yet? So they aren’t really even a user. I think I’d just delete the account and have them try again.

@pfaffman Good point. I will go for account delete.

@hawm Thank s for the link I will track it.