1 user.api.php | hook_user_presave($account) |
Act on a user account being inserted or updated.
This hook is invoked before the user account is saved to the database.
Modules that want to store properties in the serialized {users}.data column, which is automatically loaded whenever a user account object is loaded, may add their properties to $account->data in order to have their data serialized on save.
Parameters
$account: The user account object.
See also
Related topics
File
- core/
modules/ user/ user.api.php, line 212 - Hooks provided by the User module.
Code
function hook_user_presave($account) {
// Make sure that our form value 'my_module_foo' is stored as
// 'my_module_bar' in the 'data' (serialized) column.
if (isset($account->my_module_foo)) {
$account->data['my_module_bar'] = $account->my_module_foo;
}
}