You are here

function og_block_notifications in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og.module \og_block_notifications()
  2. 5 og.module \og_block_notifications()
  3. 5.2 og.module \og_block_notifications()
  4. 5.3 og.module \og_block_notifications()
1 call to og_block_notifications()
og_block in ./og.module
Implementation of hook_block().

File

./og.module, line 2448

Code

function og_block_notifications() {
  global $user;
  if ($groupnode = og_get_group_context()) {

    // only members can see this block
    if (in_array($groupnode->nid, array_keys($user->og_groups))) {
      $content = t('This group offers a !groupfeed and an !email.', array(
        '!groupfeed' => l(t('RSS feed'), "node/{$groupnode->nid}/feed"),
        '!email' => l(t('email subscription'), 'og/manage/' . $groupnode->nid),
      ));
      if (module_exists('views') && module_exists('views_rss')) {

        // NOTE: See og.css for styling specific to these lists
        $content .= ' ' . t('Or subscribe to these personalized, sitewide feeds:');
        $inline = array(
          'class' => 'links inline',
        );
        $l1[] = array(
          'title' => t('Feed'),
          'href' => 'group/myunread/feed',
        );
        $l1[] = array(
          'title' => t('Page'),
          'href' => 'group/myunread',
        );
        $links['my_unread'] = t('My unread:') . ' ' . theme('links', $l1, $inline);
        $l2[] = array(
          'title' => t('Feed'),
          'href' => 'group/mytracker/feed',
        );
        $l2[] = array(
          'title' => t('Page'),
          'href' => 'group/mytracker',
        );
        $links['my_group'] = t('My group:') . ' ' . theme('links', $l2, $inline);
        $l3[] = array(
          'title' => t('Feed'),
          'href' => 'group/tracker/feed',
        );
        $l3[] = array(
          'title' => t('Page'),
          'href' => 'group/tracker',
        );
        $links['all_posts'] = array(
          'data' => t('All posts:') . ' ' . theme('links', $l3, $inline),
        );
        $content .= theme('item_list', $links);
      }
      $block['content'] = $content;
      $block['subject'] = t('Group notifications');
      return $block;
    }
  }
}