This content originally appeared on DEV Community and was authored by Florian Stolzenhain
Original post on my blog, happy to include feedback!
Cover: Biblioteca de Arte / Art Library Fundação Calouste Gulbenkian, via New Old Stock
This creates a user according to it's email, sets a role and creates a 24h valid one-time-login.
The link can be transmitted for easy setup of password and account settings.
drush user-create [username] --mail="[user@mail]" &&\
drush user-add-role "[editor]" [username] &&\
drush uli --uri="[https://example.com]" --name="[username]"
For adding a role to multiple users, use comma separated arguments:
drush user-add-role "[editor]" [username1,username2]
Documentation
This content originally appeared on DEV Community and was authored by Florian Stolzenhain

Florian Stolzenhain | Sciencx (2025-02-14T15:03:41+00:00) Programmatically creating editor users in Drupal by mail address. Retrieved from https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.