From 226eed7047e51fe0c2fc68db89f6a1bfbe8353d4 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 6 Jun 2006 15:35:39 +0000
Subject: [PATCH] - Patch #67146 by webchick: make sure that the forum
 vocabulary shows up first.

---
 database/updates.inc       | 11 +++++++++++
 modules/forum.module       |  4 +++-
 modules/forum/forum.module |  4 +++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/database/updates.inc b/database/updates.inc
index 18079b90153c..f0249be0f614 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -2060,3 +2060,14 @@ function system_update_184() {
   return $ret;
 }
 
+function system_update_185() {
+  // Make the forum's vocabulary the highest in list, if present
+  $ret = array();
+
+  if ($vid = variable_get('forum_nav_vocabulary', 0) {
+    db_query('UPDATE {vocabulary} SET weight = %d WHERE vid = %d', -10, $vid);
+  }
+
+  return $ret;
+}
+
diff --git a/modules/forum.module b/modules/forum.module
index 4ec9da74af3b..9335271c4784 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -658,7 +658,9 @@ function _forum_get_vid() {
     // Check to see if a forum vocabulary exists
     $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
     if (!$vid) {
-      $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum' => 1));
+      // 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' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'weight' => -10, 'nodes' => array('forum' => 1));
       taxonomy_save_vocabulary($edit);
       $vid = $edit['vid'];
     }
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 4ec9da74af3b..9335271c4784 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -658,7 +658,9 @@ function _forum_get_vid() {
     // Check to see if a forum vocabulary exists
     $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
     if (!$vid) {
-      $edit = array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum' => 1));
+      // 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' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'weight' => -10, 'nodes' => array('forum' => 1));
       taxonomy_save_vocabulary($edit);
       $vid = $edit['vid'];
     }
-- 
GitLab