You are here

function og_notifications_messaging in Organic groups 5.8

Same name and namespace in other branches
  1. 5.3 og_notifications/og_notifications.module \og_notifications_messaging()
  2. 6.2 modules/og_notifications/og_notifications.module \og_notifications_messaging()
  3. 6 modules/og_notifications/og_notifications.module \og_notifications_messaging()

Implementation of hook_messaging().

File

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

Code

function og_notifications_messaging($op, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL) {
  switch ($op) {
    case 'message groups':

      // Generic notifications event
      $info['og-notifications'] = array(
        'module' => 'og_notifications',
        'name' => t('OG notifications'),
        'help' => t('Most fields will be provided during the event.'),
      );
      return $info;
    case 'message keys':
      $type = $arg1;
      switch ($type) {
        case 'og-notifications':
          return array(
            'subject' => t('Subject for event notifications'),
            'header' => t('Body header for event notifications'),
            'main' => t('Body for event notifications'),
            'footer' => t('Body footer for event notifications'),
          );
          break;
      }
      break;
    case 'messages':
      $type = $arg1;
      switch ($type) {
        case 'og-notifications':
          return array(
            'subject' => t('[site-name] subscription update for [user]'),
            'header' => t("Greetings, [user].\n\nThese are your messages"),
            'main' => t("A [type] has been updated: [title]\n\n[event_list]"),
            'footer' => array(
              t('This is an automatic message from [site-name]'),
              t('To manage your subscriptions, browse to [subscriptions-manage]'),
            ),
          );
      }
      break;
    case 'tokens':
      $tokens = array();
      if ($arg1 == 'og-notifications') {
        $tokens = array(
          'global',
          'subscription',
          'user',
          'node',
        );
      }
      return $tokens;
  }
}