| 5 forum.module | _forum_get_vid() |
Returns the vocabulary id for forum navigation.
File
- modules/
forum/ forum.module, line 654 - Enable threaded discussions about general topics.
Code
<?php
function _forum_get_vid() {
$vid = variable_get('forum_nav_vocabulary', '');
if (empty($vid)) {
// Check to see if a forum vocabulary exists
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
if (!$vid) {
// Create the forum vocabulary. Assign the vocabulary a low weight so
// it will appear first in forum topic create and edit forms.
$edit = array(
'name' => t('Forums'),
'multiple' => 0,
'required' => 1,
'hierarchy' => 1,
'relations' => 0,
'module' => 'forum',
'weight' => -10,
'nodes' => array('forum' => 1),
);
taxonomy_save_vocabulary($edit);
$vid = $edit['vid'];
}
variable_set('forum_nav_vocabulary', $vid);
}
return $vid;
}
?>Login or register to post comments