Possible to change joined date?


(Nate D.) #1

Hello everyone,

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!

Greetings from switzerland!


(Jeff Atwood) #2

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.


(Nate D.) #3

Thanks @codinghorror, I tried to search for the mentioned howtos, but I can’t find them. Can you please link to them.


(Jeff Atwood) #4

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.


(Nate D.) #5

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.


#6

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!

(Nate D.) #7

That worked just perfect on point. Thanks a lot @krilnon! :punch:


(Régis Hanol) #8