Bulk account creation
I've agreed to allow a special project that will connect students at LaGuardia to students in San Francisco to use the Commons this semester. I have a list of 25 or so accounts that need to be created. Do we have a way of doing that in bulk, perhaps from a CSV file that has email addresses and account IDs? Or would they have to be created one-by-one.
Thanks for your help.
#1 Updated by Boone Gorges over 3 years ago
- Category name set to Registration
- Status changed from New to Reporter Feedback
- Target version set to Not tracked
We don't have any user-facing tool to do this, but I can run a batch process, which will probably be marginally faster than you creating them manually.
Can you please share the CSV file with the required info? Minimally, I must have (a) desired username, (b) user email, and (c) user display name (ie, first and last name). In addition, if there's any profile data that you want created for them by default - for example, that they have a "non-CUNY" position - I may be able to include it in the batch process, depending on the complexity.
Alternatively, you can create the users yourself. 25 is right on the cusp: it's maybe just barely worthwhile for me to write the script.
#2 Updated by Matt Gold over 3 years ago
- Target version changed from Not tracked to Future release
The people proposing this changed tacks and are no longer using the Commons. Putting this in Future Release as something to consider, though maybe it dovetails with the ticket Luke opened the other day - https://redmine.gc.cuny.edu/issues/5225
#6 Updated by Boone Gorges about 3 years ago
OK, I have written the skeleton for an import script (which can be reused to some extent in the future, though the details will always depend on the formatting of the source data). Before pulling the trigger, a couple questions.
Presumably, you'll want email notification to go out to the users. Here's what WP generates by default:
SUBJECT: Your username and password info [CUNY Academic Commons] MESSAGE: Username: rubin59 To set your password, visit the following address: <http://commons.gc.cuny.edu/wp-login.php?action=rp&key=juRo5HbjARMEksQO59j4&login=rubin59> http://commons.gc.cuny.edu/wp-login.php
This is obviously pretty bare-bones. I can customize it, but it will take a bit of doing. If you want something different - or for emails not to be sent at all - let me know what you want the language to look like.
Do you need any profile fields filled in for these users? Eg, do you want them specified as non-CUNY or something like that? Or do we not care?
#7 Updated by Matt Gold about 3 years ago
Thanks so much, Boone. No email customization is needed; I asked the organizers whether these people were aware of this and wouldn't be surprised by account creation emails, and they said they all knew about it.
I also asked whether they wanted them all added to a group; I didn't hear back, so I would like to nudge them on that before we move forward (and so long as that it possible for you to do).
It would be great for them all to be marked as non-CUNY
Thank you for this!
#10 Updated by Boone Gorges about 3 years ago
- Status changed from Reporter Feedback to Resolved
- Target version changed from Future release to Not tracked
Users have been created and added to the group.
The import script is /home/commons/wp-cli-scripts/import-users.php and is intended for use with
wp eval-file. It should be fairly easily modified for future use.