Programmatically creating editor users in Drupal by mail address

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 drush user-create drush user-add-role drush uli – note uri param to generate correct URLs via shell

Feb 14, 2025 - 16:37
 0
Programmatically creating editor users in Drupal by mail address

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