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 Cause

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.

The Cure

  1. Use this php code snippet to determine what, if any, the system believes to be the forum navigation vocabulary id:

    = _forum_get_vid();
    'This is the result from _forum_get_vid() ' . $vid;
    $vid = variable_get('forum_nav_vocabulary', '');
    '<br>This is the result from
    variable_get(forum_nav_vocabulary, ) '
    . $vid;

  2. Create a new "Forums" vocabulary from administer>>categories>>add vocabulary
    name = Forums
    no description
    no help
    types = forum topic
    hiearchy = single
    required = checked
  3. Edit the vocabulary and vocabulary_node_types tables in the database.

    vocabulary table:
    * 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

What if I DON'T want the VID

What if I DON'T want the VID that the forum believes that it has, since this vis is already in use by another vocabulary? Is there a way that I decide which vid my forum has - every tim eI install forums, it's wants a specific vid - even if that is already occupied.

Submitted by Anonymous (not verified) on Thu, 2007-06-14 08:05.

Nevermind - change the vid

Nevermind - change the vid in variables field in the database.

Submitted by Anonymous (not verified) on Thu, 2007-06-14 08:21.

Finally a fix!

I am going to add a link to this article as well as a brief synopsis in the Drupal Forums. Go bless NZ mate!

Submitted by Anonymous (not verified) on Wed, 2007-08-22 11:56.