Implementation of hook_user().

File

modules/trigger/trigger.module, line 360
Enables functions to be stored and executed at a later time when triggered by other modules or by one of Drupal's core API hooks.

Code

function trigger_user($op, &$edit, &$account, $category = NULL) {

  // Keep objects for reuse so that changes actions make to objects can persist.
  static $objects;

  // We support a subset of operations.
  if (!in_array($op, array(
    'login',
    'logout',
    'insert',
    'update',
    'delete',
    'view',
  ))) {
    return;
  }
  $aids = _trigger_get_hook_aids('user', $op);
  $context = array(
    'hook' => 'user',
    'op' => $op,
    'form_values' => &$edit,
  );
  foreach ($aids as $aid => $action_info) {
    if ($action_info['type'] != 'user') {
      if (!isset($objects[$action_info['type']])) {
        $objects[$action_info['type']] = _trigger_normalize_user_context($action_info['type'], $account);
      }
      $context['account'] = $account;
      actions_do($aid, $objects[$action_info['type']], $context);
    }
    else {
      actions_do($aid, $account, $context, $category);
    }
  }
}