You are here

function og_notifications_og in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \og_notifications_og()
  2. 5 og_notifications/og_notifications.module \og_notifications_og()
  3. 5.3 og_notifications/og_notifications.module \og_notifications_og()
  4. 5.7 og_notifications/og_notifications.module \og_notifications_og()
  5. 6 modules/og_notifications/og_notifications.module \og_notifications_og()

Implementation of hook_og().

File

modules/og_notifications/og_notifications.module, line 150
Provide notifications and messaging support for organic groups.

Code

function og_notifications_og($op, $gid, $uid, $args) {
  switch ($op) {
    case 'user insert':
      $account = user_load(array(
        'uid' => $uid,
      ));
      og_notifications_user_autosubscribe($account, $gid);
      break;
    case 'user delete':
      $account = user_load(array(
        'uid' => $uid,
      ));
      og_notifications_user_unsubscribe($account, $gid);
      break;
    case 'user request':

    // This and other notifications related ops drop down to the same case.
    // These different ops have been provided for consistency and flexibility
    // during use by other modules.
    case 'user approve':
    case 'user deny':
    case 'admin create':
    case 'admin new':
    case 'admin remove':
    case 'user broadcast':
      $destinations = is_array($uid) ? $uid : array(
        $uid,
      );
      foreach ($destinations as $uid) {
        notifications_lite_send($uid, $args['subject'], $args['body']);
      }
      break;
  }
}