From 10d7f7731b0f955fd1cec7acb95051d656802b4e Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Thu, 19 Jan 2006 17:55:54 +0000
Subject: [PATCH] - Patch #45281 by chx: made categories with forum topics work
 again.

---
 modules/forum.module             | 2 +-
 modules/forum/forum.module       | 2 +-
 modules/taxonomy.module          | 3 +--
 modules/taxonomy/taxonomy.module | 3 +--
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/modules/forum.module b/modules/forum.module
index 890ff48c2e3a..7db151472472 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -604,7 +604,7 @@ function forum_form(&$node) {
 function forum_prepare(&$node) {
   if (!$node->nid) {
     // new topic
-    $node->taxonomy[] = arg(3);
+    $node->taxonomy[arg(3)] = 1;
   }
 }
 
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 890ff48c2e3a..7db151472472 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -604,7 +604,7 @@ function forum_form(&$node) {
 function forum_prepare(&$node) {
   if (!$node->nid) {
     // new topic
-    $node->taxonomy[] = arg(3);
+    $node->taxonomy[arg(3)] = 1;
   }
 }
 
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 374bf6003218..d7e27604a51c 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -531,8 +531,7 @@ function taxonomy_form_alter($form_id, &$form) {
         $form['taxonomy']['tags'][$vocabulary->vid] = array('#type' => 'textfield', '#default_value' => $typed_string, '#maxlength' => 100, '#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid, '#required' => $vocabulary->required, '#title' => $vocabulary->name, '#description' => $help);
       }
       else {
-        $ntterms = isset($node->taxonomy) ? $terms : array_keys($terms);
-        $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
+        $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, array_keys($terms), $help);
         $form['taxonomy'][$vocabulary->vid]['#weight'] = $vocabulary->weight;
       }
     }
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 374bf6003218..d7e27604a51c 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -531,8 +531,7 @@ function taxonomy_form_alter($form_id, &$form) {
         $form['taxonomy']['tags'][$vocabulary->vid] = array('#type' => 'textfield', '#default_value' => $typed_string, '#maxlength' => 100, '#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid, '#required' => $vocabulary->required, '#title' => $vocabulary->name, '#description' => $help);
       }
       else {
-        $ntterms = isset($node->taxonomy) ? $terms : array_keys($terms);
-        $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
+        $form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, array_keys($terms), $help);
         $form['taxonomy'][$vocabulary->vid]['#weight'] = $vocabulary->weight;
       }
     }
-- 
GitLab