You are here

function forum_enable in Drupal 6

Same name and namespace in other branches
  1. 7 modules/forum/forum.install \forum_enable()

File

modules/forum/forum.install, line 13

Code

function forum_enable() {
  if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0))) {

    // Existing install. Add back forum node type, if the forums
    // vocabulary still exists. Keep all other node types intact there.
    $vocabulary = (array) $vocabulary;
    $vocabulary['nodes']['forum'] = 1;
    taxonomy_save_vocabulary($vocabulary);
  }
  else {

    // Create the forum vocabulary if it does not exist. Assign the vocabulary
    // a low weight so it will appear first in forum topic create and edit
    // forms.
    $vocabulary = array(
      'name' => t('Forums'),
      'multiple' => 0,
      'required' => 0,
      'hierarchy' => 1,
      'relations' => 0,
      'module' => 'forum',
      'weight' => -10,
      'nodes' => array(
        'forum' => 1,
      ),
    );
    taxonomy_save_vocabulary($vocabulary);
    variable_set('forum_nav_vocabulary', $vocabulary['vid']);
  }
}