You are here

function _trigger_user in Drupal 7

Calls action functions for user triggers.

Parameters

$hook: The hook that called this function.

$edit: Edit variable passed in to the hook or empty array if not needed.

$account: Account variable passed in to the hook.

$method: Method variable passed in to the hook or NULL if not needed.

7 calls to _trigger_user()
trigger_user_cancel in modules/trigger/trigger.module
Implements hook_user_cancel().
trigger_user_delete in modules/trigger/trigger.module
Implements hook_user_delete().
trigger_user_insert in modules/trigger/trigger.module
Implements hook_user_insert().
trigger_user_login in modules/trigger/trigger.module
Implements hook_user_login().
trigger_user_logout in modules/trigger/trigger.module
Implements hook_user_logout().

... See full list

File

modules/trigger/trigger.module, line 558
Enables functions to be stored and executed at a later time.

Code

function _trigger_user($hook, &$edit, $account, $category = NULL) {

  // Keep objects for reuse so that changes actions make to objects can persist.
  static $objects;
  $aids = trigger_get_assigned_actions($hook);
  $context = array(
    'group' => 'user',
    'hook' => $hook,
    'form_values' => &$edit,
  );
  foreach ($aids as $aid => $info) {
    $type = $info['type'];
    if ($type != 'user') {
      if (!isset($objects[$type])) {
        $objects[$type] = _trigger_normalize_user_context($type, $account);
      }
      $context['user'] = $account;
      actions_do($aid, $objects[$type], $context);
    }
    else {
      actions_do($aid, $account, $context, $category);
    }
  }
}