During the user registration process in Drupal 7, at which point can I access the newly created UID to create 'default content' for that user? I would like to do this as early on as possible. Preferably before the user has been approved by an admin or before they have verified their email address.

2 Answers 2


You can use hook_user_insert(), it should be early enough for you.

Technically speaking, hook_user_presave() is the first hook called from user_save() (even before the user is written to the database), but according to the documentation it is "primarily intended for modules that want to store properties in the serialized {users}.data column". More importantly, it is also invoked when a user account is updated, so that wouldn't fit your use case.


Implement hook_user_insert().

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.