You are here

function og_og in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og_workflow_ng.inc \og_og()
  2. 5 og_workflow_ng.inc \og_og()
  3. 5.3 og_workflow_ng.inc \og_og()
  4. 5.7 og_workflow_ng.inc \og_og()
  5. 6 og.module \og_og()

Implementation of hook_og().

File

./og.module, line 643
Code for the Organic Groups module.

Code

function og_og($op, $gid, $uid, $args) {
  if (module_exists('rules')) {
    if (in_array($op, array(
      'user insert',
      'user delete',
    ))) {
      rules_invoke_event('og_' . str_replace(' ', '_', $op), $uid, $gid);
    }
    elseif ($op == 'user update' && $args['is_active']) {
      rules_invoke_event('og_user_approved', $uid, $gid);
    }
  }
  if (module_exists('trigger')) {
    $aids = _trigger_get_hook_aids('og', $op);
    if (!empty($aids)) {
      $account = user_load($uid);
      $group = node_load($gid);
      $context = array(
        'hook' => 'og',
        'op' => $op,
        'node' => $group,
        'user' => $account,
        'args' => $args,
      );
      foreach ($aids as $aid => $action_type) {
        actions_do($aid, $group, $context);
      }
    }
  }
}