You are here

function og_views_block_notifications in Organic groups 6

Same name and namespace in other branches
  1. 6.2 modules/og_views/og_views.module \og_views_block_notifications()
1 call to og_views_block_notifications()
og_views_block in modules/og_views/og_views.module

File

modules/og_views/og_views.module, line 89

Code

function og_views_block_notifications() {
  global $user;
  if ($groupnode = og_get_group_context()) {
    $content = t('This group offers a <a href="@groupfeed">RSS feed</a>', array(
      '@groupfeed' => url("node/{$groupnode->nid}/feed"),
    ));
    if (module_exists('og_notifications') && $user->uid) {
      $content .= t(' and an <a href="@email">email subscription</a>.', array(
        '@email' => url('user/$user->uid/notifications/group'),
      ));
    }
    else {
      $content .= '.';
    }

    // NOTE: See og.css for styling specific to these lists
    $content .= ' ' . t('Or subscribe to these personalized, sitewide feeds:');
    $inline = array(
      'class' => 'links inline',
    );
    if ($user->uid) {
      $l1[] = array(
        'title' => t('Feed'),
        'href' => 'group/myunread/feed',
      );
      $l1[] = array(
        'title' => t('Page'),
        'href' => 'group/myunread',
      );
      $links['my_unread'] = t('My unread: !links', array(
        '!links' => 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: !links', array(
        '!links' => 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: !links', array(
        '!links' => theme('links', $l3, $inline),
      )),
    );
    $content .= theme('item_list', $links);
    $block['content'] = $content;
    $block['subject'] = t('Group notifications');
    return $block;
  }
}