Adjust register date for user

Hi guys,

Today I had an unusual request after a migration where we skipped all accounts that never posted.

A user that had never posted, but values having an account, wanted his account back. I told him he could just re-register with his old username which he did. But now he wants to have his ‘member since’ adjusted to 2011, when he registered his old account…

Is there any way I can accomplish this?

By ‘member since’ do you mean the Joined section in your account summary?

Screenshot_2021-04-17 Profile - cocococosti - Discourse Meta

If you have admin access to the server or database, you could edit the created_at parameter for that user in the Users table.

You can do it from the rails console this way:

rails c
user = User.where(username: '<your-username-here>')
user.update(created_at: "2011-02-10 00:00:00.00000")

You could also do it directly in the Postgre database (although I don’t recommend it):

update public.users set created_at='2011-02-10 00:00:00.00000' where username = '<your-username-here>';

I tested this in my local environment and worked correctly:

Changed from:
Screenshot_2021-04-17 Profile - costi abarca - Constanza's discourse(1)

Screenshot_2021-04-17 Profile - costi abarca - Constanza's discourse

Please be very careful if you decide to go with this, I suggest you take a backup of the database before doing anything :sweat_smile:


Thanks a lot. That was the parameter I needed to change.


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