How to Fix a Broken Drupal Forum
If you posting to your existing drupal forum or you are trying to set up a new one but the forum categories don't show up and consequently the posts don't appear in your forums then chances are that the system generated "Forums" vocabulary is missing.
If you have ever had the misfortune to either accidentally or on purpose delete the taxonomy category for your Drupal Forum module you are sure to have had some difficulties in getting it working again.
After a lot of searching I came accross a fairly simple solution on the drupal website (all credit to the original author - SomebodySysop).
My dilema was that I had done exactly that. On one of the first drupal sites I built I had deleted the Forum category. After all I had no intention of using it. But as the site grew a forum became necessary. So, I had to find an answer.
The problem is caused because the system doesn't have the correct Forums Navigation Vocabulary ID number (VID). The vid of the default "Forums" vocabulary is initially created automatically by the system and handles the process of creating vocabularies and terms from administer>>forums entries.
- Use this php code snippet to determine what, if any, the system believes to be the forum navigation vocabulary id:
$vid = _forum_get_vid();
print 'This is the result from _forum_get_vid() ' . $vid;
$vid = variable_get('forum_nav_vocabulary', '');
print '<br>This is the result from
variable_get(forum_nav_vocabulary, ) ' . $vid;
- Create a new "Forums" vocabulary from administer>>categories>>add vocabulary
name = Forums
types = forum topic
hiearchy = single
required = checked
- Edit the vocabulary and vocabulary_node_types tables in the database.
* Change the vid to the number you get from _forum_get_vid() above.
* Change the module field to "forum".
* Change the vid to the same number you edited into vocabulary table above.
You should now have a working forum again. This was tested and confirmed to work on Drupal 4.7.6 and 5.1.x