forum_update_6000

Versions
6
forum_update_6000()

Create the forum vocabulary if does not exist. Assign the vocabulary a low weight so it will appear first in forum topic create and edit forms. Do not just call forum_enable() because in future versions it might do something different.

Code

modules/forum/forum.install, line 107

<?php
function forum_update_6000() {
  $ret = array();

  $vid = variable_get('forum_nav_vocabulary', 0);
  $vocabularies = taxonomy_get_vocabularies();
  if (!isset($vocabularies[$vid])) {
    $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']);
  }

  return $ret;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.