You are here

function notifications_forum_preprocess_forum_list in Forum notifications 6

Same name and namespace in other branches
  1. 7 notifications_forum.module \notifications_forum_preprocess_forum_list()

Preprocess function for theme_forum_list().

Adds a subscribe/unsubscribe link under each forum on the forum list.

File

./notifications_forum.module, line 306

Code

function notifications_forum_preprocess_forum_list(&$vars) {
  if (user_access('subscribe to taxonomy terms')) {
    foreach ($vars['forums'] as $forum_id => &$forum) {
      list($type, $url) = _notifications_forum_toggle_subscription_url($forum_id);
      $link = t($type == 'subscribe' ? '<a href="!url">Subscribe</a> to this forum' : '<a href="!url">Unsubscribe</a> from this forum', array(
        '!url' => $url,
      ));
      $forum->description .= "<div class='forum-subscribe'>{$link}</div>";
    }
  }
}