function advanced_forum_allowed_node_types in Advanced Forum 6.2
Same name and namespace in other branches
- 7.2 advanced_forum.module \advanced_forum_allowed_node_types()
Return an array of node types allowed in a given vocabulary or term ID.
Note: TID is currently for future use and not acted on.
2 calls to advanced_forum_allowed_node_types()
- advanced_forum_node_type_create_list in ./
advanced_forum.module - Generate a list of node creation links for a forum.
- advanced_forum_type_is_in_forum in ./
advanced_forum.module - Return whether a given node type is allowed in the whole forum or given forum.
File
- ./
advanced_forum.module, line 1077 - Enables the look and feel of other popular forum software.
Code
function advanced_forum_allowed_node_types($tid = 0, $vid = 0) {
if (module_exists('forum_access')) {
// Check with forum access to see if this forum allows node creation.
// If it doesn't, send back an empty list.
if (!forum_access_access($tid, 'create', NULL, TRUE)) {
return array();
}
}
// If no vocabulary is passed in, assume it should be the forum vocab.
$vid = empty($vid) ? variable_get('forum_nav_vocabulary', '') : $vid;
$vocabulary = taxonomy_vocabulary_load($vid);
if (is_array($vocabulary->nodes)) {
// There are some node types associated with this vocab so return them.
return $vocabulary->nodes;
}
else {
return array();
}
}