When is hook_user_presave triggered? I'm trying to create a little module that operates on similar principals as a shopping cart, but has nothing to do with e-commerce. I want to add paired values to $user-&gt;data['cart'] on a very frequent basis. Everyone seems to agree that hook_user_presave is the way to do this. My question is this, when does hook_user_presave trigger? Can it be called from inside another fucntion or an .inc file, or does it happen on pageload? I am absolutely befuddled, since I thought hooks were basically event handlers for Drupal Core. 

Can I, say, do the following? 

test.module:
&lt;?php
function mymodule_user_presave (&amp;$edit, $account, $category) {
    $edit['data']['cart'] = $edit;
}
/* ... */

test.inc:
&lt;?php
/* ... */
function mysavefunction () {
  $myvar = array('sweetdata' =&gt; 5);
  $account = user_load($user -&gt; uid);
  mymodule_user_presave ($myvar, $account) 
}
/* ... */


If you could even point me to some documentation other than this useless api page, I would be greatly in your debt.
hook_user_presave is an event listener that's called when a user account is saved.

It's invoked from user_save and shouldn't normally be called manually.

// Invoke hook_user_presave() for all modules.
user_module_invoke('presave', $edit, $account, $category);


If you want to save data on the user account, just use user_save