| 7 user.api.php | hook_user_update(& |
| 8 user.api.php | hook_user_update($account) |
A user account was updated.
Modules may use this hook to update their user data in a custom storage after a user account has been updated.
Parameters
$edit: The array of form values submitted by the user.
$account: The user object on which the operation is performed.
$category: The active category of user information being edited.
See also
Related topics
2 functions implement hook_user_update()
3 invocations of hook_user_update()
File
- modules/
user/ user.api.php, line 275 - Hooks provided by the User module.
Code
function hook_user_update(&$edit, $account, $category) {
db_insert('user_changes')
->fields(array(
'uid' => $account->uid,
'changed' => time(),
))
->execute();
}
Login or register to post comments
Comments
hook_user_update and Field API
Hello,
I implemented hook_user_update in a module and I'm executing a shell script after this that collect all kind of data.
The problem is that when I do so, the data is not still updated.
I'm using Field API and my question is, it is possible that field API values are updated AFTER hook_user_update?
Thanks!
See user_save().
Not according to the code in user_save() that handles all this.
$edit isn't what you think it is
By the time we get to hook_user_update, $edit and $account are actually the same. If you need to check for changed values, compare $account and $account->original instead.