You are here

function ad_actions_ad_actions_trigger in Advertisement 6.2

Same name and namespace in other branches
  1. 6.3 actions/ad_actions.module \ad_actions_ad_actions_trigger()
  2. 7 actions/ad_actions.module \ad_actions_ad_actions_trigger()

Implementation of hook_trigger_name(). Trigger event, launch all appropriate actions.

File

actions/ad_actions.module, line 318
Enable ad triggers and actions.

Code

function ad_actions_ad_actions_trigger($op, $ad) {
  global $user;
  if (!in_array($op, array(
    'click',
    'approved',
    'pending',
    'offline',
    'denied',
    'active',
    'autoactivated',
    'expired',
    'autoexpired',
    'created',
    'update',
    'delete',
  ))) {
    return;
  }
  $aids = _trigger_get_hook_aids('ad_actions', $op);
  $node = node_load($ad['aid']);
  $context = array(
    'hook' => 'ad_actions',
    'op' => $op,
    'user' => $user,
    'node' => $node,
    'ad' => $node,
  );
  actions_do(array_keys($aids), $node, $context);
}