I am looking for a hook to fire off an Entity creation method (for an unrelated item that pertains to the user) when a user registers for the site. I'm divided between hook_form_user_register_form_alter and hook_user_insert. What's the best approach here, and i'm wondering which one is the best to use here.

  • can we have clear information what exactly you looking for ? Required more information :) Oct 14 '14 at 11:01
  • Sure -- I have an entity that essentially serves as a has-many to about 20-30 nodes with a specific content type (pertaining to a "Daily Tasks" content). The hierarchy for the entity works out to having an ID reference to the user associated, the node id reference, and if the node is "completed." In essence, I need to insert 20-30 Entity records pertaining to each node per a newly created user. Oct 14 '14 at 12:38

After doing my due diligence, I chose to use the hook_user_insert() to extend my logic for the entity creation. It fires when a new user is verified and added to the users table/entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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