function hook_user_update

7 user.api.php hook_user_update(&$edit, $account, $category)
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

hook_user_presave()

hook_user_insert()

Related topics

2 functions implement hook_user_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_user_update in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_user_update().
trigger_user_update in modules/trigger/trigger.module
Implements hook_user_update().
3 invocations of hook_user_update()
field_attach_update in modules/field/field.attach.inc
Save field data for an existing entity.
update_check_requirements in ./update.php
Checks update requirements and reports errors and (optionally) warnings.
user_save in modules/user/user.module
Save changes to a user account or add a new user.

File

modules/user/user.api.php, line 277
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();
}

Comments

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!

Not according to the code in user_save() that handles all this.

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.

hello,
Is $category help me to see wich form invoke my hook ?

I have a custom script who save my user and i don't want my notification mail to be send when i use this custom script. ( i invoke drupal_mail in my hook_user_update )

Thanks for your help.