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 ca…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Programmatically creating editor users in Drupal by mail address." Florian Stolzenhain | Sciencx - Friday February 14, 2025, https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/
HARVARD
Florian Stolzenhain | Sciencx Friday February 14, 2025 » Programmatically creating editor users in Drupal by mail address., viewed ,<https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/>
VANCOUVER
Florian Stolzenhain | Sciencx - » Programmatically creating editor users in Drupal by mail address. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/
CHICAGO
" » Programmatically creating editor users in Drupal by mail address." Florian Stolzenhain | Sciencx - Accessed . https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/
IEEE
" » Programmatically creating editor users in Drupal by mail address." Florian Stolzenhain | Sciencx [Online]. Available: https://www.scien.cx/2025/02/14/programmatically-creating-editor-users-in-drupal-by-mail-address/. [Accessed: ]
rf:citation
» Programmatically creating editor users in Drupal by mail address | Florian Stolzenhain | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.