Change user registration date (created_at) via API

Hi, I am experimenting with migration from another platform to Discourse using the API.
I have a lot of users and I will migrate them to Discource.
When I create a user, it has today’s creation date.
But many users are 10+ years on the forum and it will be a shame to lose it after moving.

When I try to update the user via API, I want to update the created_at field.

'created_at' => '2013-05-04T11:49:06.782Z'

But the date does not change. Perhaps there is another way?

2 Likes

Is there a reason not to use a migration script? This and many other problems you are likely to encounter will be solved.

2 Likes

Oh, yes, we will use the migration from your team when we have a database dump.

I am just experimenting now, as I do not yet know all the functions of Discourse. On the old forum, we had special groups and roles. I am doing the import via API to configure it in Discourse.

I also want to understand in detail how to work with Trust Levels, Groups, and Badges. And some of them depend on the date of registration.

None of those things depends on the user creation date. :wink:

I think you might be able to push a created_at value in a push or a post.

1 Like

Ok,
I just saw the settings depending on the number of days, but have not yet read them in detail. Just put it off until user testing.

2 Likes

I think you might be able to push a created_at value in a push or a post.

I make a request to update several fields for the test.

    'created_at' => '2013-05-04T11:49:06.782Z',
    'user_fields' => [
        1 => '104',
        2 => 'Patron'
    ]

In this case User_fileds are updated without any problems. So I decided to ask in the forum. Maybe created_date is updated by some other request such as trust_levels which have a special url API.

1 Like

You can do it at the rails console. You can also just change their trust level. Description of various user states in Discourse (Admin / Moderator / Staff / Developer / Other) there are other topics in that category.

1 Like

Thank you for sharing and for the insight👌