You are here

function og_notifications_messaging in Organic groups 6

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

Implementation of hook_messaging().

File

modules/og_notifications/og_notifications.module, line 180
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 (default)'),
        'help' => t('Most fields will be provided during the event.'),
        'description' => t('Notifications for organic groups node events. Other group notification strings can be customized via the <a href="!url">OG config</a> page.', array(
          '!url' => url('admin/og/og'),
        )),
      );
      $info['og-notifications-insert'] = array(
        'module' => 'og_notifications',
        'name' => t('OG notifications for new content'),
        'help' => t('Most fields will be provided during the event.'),
        'description' => t('Notifications for organic groups node creation events.'),
      );
      $info['og-notifications-update'] = array(
        'module' => 'og_notifications',
        'name' => t('OG notifications for updated content'),
        'help' => t('Most fields will be provided during the event.'),
        'description' => t('Notifications for organic groups node update events.'),
      );
      $info['og-notifications-comment'] = array(
        'module' => 'og_notifications',
        'name' => t('OG notifications for comments'),
        'help' => t('Most fields will be provided during the event.'),
        'description' => t('Notifications for organic groups comment events.'),
      );
      return $info;
    case 'message keys':
      $type = $arg1;
      switch ($type) {
        case 'og-notifications':
        case 'og-notifications-insert':
        case 'og-notifications-update':
        case 'og-notifications-comment':
          return array(
            'subject' => t('Subject'),
            'header' => t('Body header'),
            'main' => t('Body'),
            'footer' => t('Body footer'),
          );
          break;
      }
      break;
    case 'messages':
      $type = $arg1;
      switch ($type) {
        case 'og-notifications':
        case 'og-notifications-update':
          return array(
            'subject' => t('[site-name] [ogname]: [title]'),
            'header' => t("Greetings, [user],"),
            'main' => array(
              t('A [type-name] has been updated in group [ogname]: [title]'),
              t('[node-teaser]'),
              t('Read more at [node-url].'),
            ),
            'footer' => array(
              t('This is an automatic message from [site-name]'),
              t('To manage your subscriptions, browse to [subscriptions-manage]'),
            ),
          );
        case 'og-notifications-insert':
          return array(
            'subject' => t('[site-name] [ogname]: [title]'),
            'header' => t("Greetings, [user],"),
            'main' => array(
              t('A [type-name] has been created in group [ogname]: [title]'),
              t('[node-teaser]'),
              t('Read more at [node-url].'),
            ),
            'footer' => array(
              t('This is an automatic message from [site-name]'),
              t('To manage your subscriptions, browse to [subscriptions-manage]'),
            ),
          );
        case 'og-notifications-comment':
          return array(
            'subject' => t('[site-name] [ogname]: [title]'),
            'header' => t("Greetings, [user],"),
            'main' => array(
              t('A new comment has been added by [comment-author-name] to this thread in group [ogname]: [comment-title]'),
              t('[comment-body]'),
              t('Read more at [comment-url] or reply via [comment-reply-url].'),
            ),
            '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 (strpos($arg1, 'og-notifications') === 0) {
        $tokens = array(
          'global',
          'subscription',
          'user',
          'node',
          'comment',
        );
      }
      return $tokens;
  }
}