1.20.x 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
- 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 'mymodule_foo' is stored as
// 'mymodule_bar' in the 'data' (serialized) column.
if (isset($account->mymodule_foo)) {
$account->data['mymodule_bar'] = $account->mymodule_foo;
}
}