You are here

function og_block_notifications in Organic groups 5.2

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

File

./og.module, line 2083

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;
    }
  }
}