In the _logintoboggan_process_validation() function, it calls user_module_invoke('update', ...) so that other modules can react to the user having been validated. I've got a custom module, that controls a users registration to a mailing list. I've got a hook_user that checks for 'after_update' because it needs to also catch changes to $account->language. Users should only be on the mailing list if they are validated.
Anyway, to make a long story short, logintoboggan only fires 'update' and not 'after_update' so my code doesn't happen. Of course, I can put in a bunch of hacks (like $account->language = $edit['language']) so that I can do my mailing list updates in 'update', but I really think that logintoboggan should call 'after_update' as well as 'update'. Other modules which depend on 'after_update' to react to user changes will also be broken.
Here is a very small patch that makes this change.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| logintoboggan-after_update.patch | 457 bytes | dsnopek |
Comments
Comment #1
hunmonk commentedbefore i commit this, i'd like to get clear on how this will impact the 7.x branch.
looking at http://api.drupal.org, i don't see any hook_user_after_update() for 7.x, only hook_user_update(). does the 7.x update hook now happen at the same time as the 6.x after_update hook?
if so it would appear no change is needed for 7.x. if not, then that seems like a regression in core functionality...
Comment #2
dsnopekI don't know Drupal 7 (yet!), but its possible that hook_user_presave() is the equivalent there? The idea is a hook that runs after all the 'update' / 'insert's have run. This is just my impression looking over the documentation for about 1 minute. We'll need the opinion of someone who actually knows Drupal 7.
Comment #3
hunmonk commentedhttp://drupal.org/update/modules/6/7#hook_user_after_update
so, given that documentation, we also need a patch for 7.x, then i can move forward to commit all necessary changes.
Comment #4
YK85 commentedsubscribing
Comment #5
hunmonk commentedturns out 7.x doesn't need any change. committed to 6.x-1.x-dev, thanks!