I want the last updated time of the user profile details. So i have created a table user_changes with fields ( id, uid, changed ). When i use this hook_user_update hook , then data is not inserted into the table. I'm using this function in my theme's template.php
function garland_user_update(&$edit, $account, $category) {
db_insert('user_changes')->fields(array(
'uid' => $account->uid,
'changed' => time(),
))->execute();
exit;
}
Let me know if you want any details. Thanks in advance.
Hooks must be implemented in modules, not in themes. For that, choose a name (e.g. example
), create a directory by that name in sites/all/modules
, create the example.info
file with content
name = Example
description = Does some fancy stuff in certain situations
core = 7.x
in that directory and put your function in sites/all/modules/example/example.module
. You also have to rename your function to example_user_update
.
Further reading:
module_invoke_all
, the function that is used to invoke hook implementations.