You are here

function advanced_forum_type_is_in_forum in Advanced Forum 7.2

Same name and namespace in other branches
  1. 6.2 advanced_forum.module \advanced_forum_type_is_in_forum()

Return whether a given node type is allowed in the whole forum or given forum.

2 calls to advanced_forum_type_is_in_forum()
advanced_forum_form_alter in ./advanced_forum.module
Implements hook_form_alter().
advanced_forum_preprocess_page in includes/theme.inc
Preprocesses template variables for the page template.

File

./advanced_forum.module, line 1143
Enables the look and feel of other popular forum software.

Code

function advanced_forum_type_is_in_forum($node, $tid = 0) {
  $vid = empty($vid) ? variable_get('forum_nav_vocabulary', 0) : $vid;
  if (!empty($node->taxonomy_forums)) {

    // Check for language used.
    if (!isset($node->taxonomy_forums[$node->language])) {
      $langcode = LANGUAGE_NONE;
    }
    else {
      $langcode = $node->language;
    }
    foreach ($node->taxonomy_forums[$langcode] as $tforum) {
      if (!isset($tforum['taxonomy_term'])) {
        continue;
      }
      if ($tforum['taxonomy_term']->vid == $vid || $tforum['taxonomy_term']->tid == $tid) {
        return TRUE;
      }
    }
  }
  return FALSE;
}