It would be super helpful to have the ability to upload a .csv (much like bulk invites) which contained the following:
- custom field name
- custom field value
And then have this data directly applied to the users’ accounts. Only if the username and custom field name are valid of course!
This would help enormously with data tidy-up exercises and migrations, which appear to be darn tricky with user custom fields.
If it’s for an import then it’s easy to do it in the importer.
You might also use the API.
Is hard to imagine acsv upload solution that would be easier.
Well, my use case is for restoring some user custom fields which I inadvertently wiped for a bunch of users (see Problem with manipulating custom user fields from the Rails console). I’ve got the backup on a staging site, and I’ve also got them as a .csv
When you say ‘easy’ I’m guessing you mean it would take you a few hours to bash something out that would do the job. Can you give me a cost estimate?
Send me an email with details.
Jay has delivered the goods:
It requires some competence with Linux / Bash in order to use it, and I’d strongly recommend doing a backup first and doing it at a quiet time as you can royally stuff up your user data if not careful. I trialled it on a staging server before using it on our production site.
You might find this Data Explorer query useful in order to get the existing data for the
user_field that you are targeting:
-- string :ucf_name = user_field_1
user_id, value as ":ucf_name"
WHERE name = :ucf_name
ORDER BY user_id asc
Note that you’ll have to remove the
' from either side of the field name in the .csv as I couldn’t work out how to stop the query including them.