The discussion revolves around changing a user’s joined date on Discourse. ndalliard asked if it’s possible to change the joined date for a given user, specifically to make the first user (admin and system) appear to have joined on launch day.
codinghorror replied that changing the joined date is only possible through SQL at the Ruby command prompt, not through the UI. ndalliard sought further guidance and was directed to a topic on editing user settings, but found it wasn’t directly applicable.
krilnon provided a solution, sharing a Ruby script that manually modifies a user’s joined date. The script, which ndalliard successfully implemented, involves finding the user, updating their created_at timestamp, and saving the changes.
this is my first post here, I hope I am doing everything right.
Is it possible to change the joined date for any given user?
I ask, because I want to bootstrap my forum and make it ready for launch day, but I want the first user (admin and system) to be joined on launch day and not before. Any idea how I could achieve that if I can not change the joined date?
I could delete my admin account on launch day an register a new one. Is that possible with the user @system ?
Thanks guys, the software is really easy and fast to install. I love it so far!
Only from SQL at the Ruby command prompt. Not in the UI at this time. But changing it via a DB query should be straightforward, there are some howtos here on that.
Yeah good point I did some searching but nothing good came up immediately. We should have a dedicated howto topic for entering the container, and running an arbitrary SQL query. @techapj can you assist?
It’s kind of like this
But more generic. That’s basically impossible to find if you want to just “run a query” against your Discourse database.
If me and @system are the only two users in the forum I can run a query to change the joined date for all users, as mentioned in the topic you linked. But I’ve no idea how that query should look like. I will wait for @techapj, hopefully he can help me with that.
I did some manual join date modification for some of the oldest users on a forum when I migrated. Like Jeff suggested, you basically need to pick out the users manually, like so:
user = User.find_by(username: 'krilnon')
user.created_at = Time.now
# user.created_at = Time.parse('2013-02-04 3:00 PM') # to backdate
user.save!