What would be the proper hook to redirect after the user registration form is submitted and is in valid state?
I’m trying to automatically create a certain content-type node when a user registers and I want to redirect the user to that node’s edit form after the user creation form is submitted and validated.
I was thinking of doing this in a mymodule_user_form_submit
hook, but not sure if a) this hook exists and b) the validation in place for user registration will still work as intended.
Can anyone share some pointers?
EDIT:
Would the mymodule_user_insert
hook run after the validation and submission of the form? Can I redirect from there? AFAIK, I won’t have a form_state
variable to act on, right?
EDIT2:
While researching for a solution, I noticed I have another (probably bigger) problem: the content-type node I need to create must hold a reference to the user’s ID, so I’m getting in a chicken-or-egg situation.
I actually need to create said node after the user is created (otherwise I’ll have no user_id), but I need to redirect to the node’s edit form after user creation, which means I can’t redirect with $form_state
.
I think I got everything right, but I would love to be wrong. 😀
Can anyone help?