You are here

function template_preprocess_forum_icon in Advanced Forum 5

Process variables to format the icon for each individual topic.

$variables contains the following data:

  • $new_posts
  • $num_posts = 0
  • $comment_mode = 0
  • $sticky = 0

See also

forum-icon.tpl.php

theme_forum_icon()

File

./d6_compat.inc, line 240
Code needed to backport functionality from D6.

Code

function template_preprocess_forum_icon(&$variables) {
  $variables['hot_threshold'] = variable_get('forum_hot_topic', 15);
  if ($variables['num_posts'] > $variables['hot_threshold']) {
    $variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot';
  }
  else {
    $variables['icon'] = $variables['new_posts'] ? 'new' : 'default';
  }
  if ($variables['comment_mode'] == COMMENT_NODE_READ_ONLY || $variables['comment_mode'] == COMMENT_NODE_DISABLED) {
    $variables['icon'] = 'closed';
  }
  if ($variables['sticky'] == 1) {
    $variables['icon'] = 'sticky';
  }
}