I notice we already have an example for programmatically creating a new user in Create a user programmatically and give they a role. However, this example uses user_save(), which does not mimic the registration process, (e.g. no email is sent to the user).

Could I use user_register_submit()?

1 Answer 1


I'm not clear on what your overall goals are here. However, you might check out the Form Clerk module. You can use it to create users, as well as many other things.

Form Clerk is an administrative utility that provides a semi-automated way to input data into a Drupal form. Multiple instances of form data can be entered with one command. For example, multiple users with varying permissions can be created, or multiple articles with arbitrary content can be added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.