Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
user system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
5 May 2006 at 08:53 UTC
Updated:
13 Dec 2009 at 06:20 UTC
On 'insert' we call the hook_user only after the user object is fileld. But 'update' is called before that and it's good because your module may want to update the account before saving. But if you want to reuse the user object for some reason then a symmetric op is needed for update, too.
| Comment | File | Size | Author |
|---|---|---|---|
| update_post.patch | 350 bytes | chx |
Comments
Comment #1
killes@www.drop.org commented+1, but "update post" sounds a bit strange.
Comment #2
drummHow about 'after_update'? (Naming convention borrowed from #after_build.)
Comment #3
chx commentedI am fine with either. We had 'form post' at one time. Also, 'post update' or 'after update' works, too.
Comment #4
drummCommitted to HEAD with after_update.
Please document in hook_user() in contrib.
Comment #5
chx commentedDone.
Comment #6
moshe weitzman commentedSorry, I just saw this. Can we attempt to maintain consistency with nodeapi hooks? Lets compare the two of them as of today:
NODE
validate => submit => insert/update
USER
validate => => insert/update => after_update
I propose we standardize like:
validate => submit -> insert/update => after_update
If you wantt omess with the object before submission, you use the submit operation. if hyou want the operation after the node is all saved tothe DB, use after_update ... there is a long standing request for nodes to have this after_update hook so we will be helping them too.
Comment #7
chx commentedreopening because Moshe is right (not that it surprises anyone).
Comment #8
RobRoy commentedI was looking for some type of after_insert for when new user accounts are created, but noticed that user_save() only calls after_update when updating a user (not for both insert/update operations) and there is no similar way to trigger something for after_insert. We can attach a custom #submit handler for any new user forms, but shouldn't we have some type of after_insert invoked in user_save()?
Comment #9
sunSolved in D7 via #118345: Revamp hook_user_form/_register/_validate/_submit/_insert/_update
validate => submit => presave => insert/update