Populating a custom user data field

On our DIscourse-hosted site we have a custom user data field for a user’s member ID in our organization.

What’s the easiest way to populate it for around 2000 users brought over from our old phpbb3 system? (I can generate a list of what username is what member ID.)

And is there any way to ensure that the contents of that field (when non- null) is unique?

1 Like

Hi Mike :slight_smile:
If I understand well, you created a custom user field that is currently empty and wants to fill it in for each existing user based on data you have somewhere.

I’ll do that with a rail script, and I’ll check the content is unique inside the script.

Since it was migrated from phpBB, do you have any reason to believe phpBB users’ IDs wouldn’t be unique?

If you’re Discourse-hosted, I’d ask directly to team@discourse.org as you don’t have access to the rails console; maybe experts will have better solutions. :slight_smile:

1 Like

I’m not the project leader on this (officially, I retired in 2016, I’m just helping with the discussion forums migration because of my long experience with it), I’ll ask him if we can have that done as part of the data migration. Otherwise, I could probably do it via the API.

A one-to-one relationship between Discourse usernames and member IDs isn’t an absolute necessity, I was just wondering if there was a way to enforce one. I can use the data explorer tool to look for non-uniqueness once the field is populated.

1 Like

I’ve passed this task along to the primary contact for our Discourse group, as he’s been handling the data migration.

1 Like