1

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

3

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.

0

Implement hook_user_insert().

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.