1) disable forum module, save settings, re-enable forum module, save settungs
2) I was expecting the forums to exist and operate as normal.
3) In Categories their type is missing and create content/forum topic has no forums listbox to choose from.

I'm borrowing relevant information from another issue as it explains the problem better than I can.

The Forum module has the forum content type. Content types often have a taxonomy structure related to them. In the case of the Forum module the taxonomy is crucial because the entire forum structure depends on it. The following problem occurs when a module is disabled:

"when a module is disabled, the corresponding node type is removed from the vocabulary_node_types table."

If the forum module is enabled again, the corresponding node type is not automatically added in the vocabulary_node_types table. This it no longer exists.

In the Forum module this gets even worse, because there is no way to set the node type for the Forum vocabulary (the forum module disables this option for some reason). Only adding the node type manually to the table helps in this case.

For the Forum module, there is no way to repair the vocabulary_node_types table using the Categories administration page in Drupal; one has to edit the database manually, so at least for the Forum module this should be considered a critical priority bug.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

langweer’s picture

Version: 6.x-dev » 5.5

I had the same problem and have posted my solution here: http://drupal.org/node/203399#comment-668300
Maybe it is a solution for someone else, too.

update on 28-12-2007: Excuse me: I was talking about 5.5 (not 6).

nsk’s picture

I can confirm this on fresh 5.5 install: I enabled the forum module, created two forum categories, posted a post, then disabled the module, then re-enabled, and I can confirm that the type from the category is missing and that in Create content one cannot choose the forum categories anymore.

nsk’s picture

Version: 5.5 » 6.x-dev

I can also confirm this issue with the latest 6.0-dev HEAD nightie (December 28, 2007 - 02:03). Type of the forum post in taxonomy was lost. Add content form did not include the forum categories...

Gábor Hojtsy’s picture

Hm, well, the forum module adds its node type with the node type definition hooks (forum_node_info()), so it should be picked up when you visit the module list page after enabling the forum module (which is automatically done on form submission). system_modules() contains the code on the top.

Anyway, tried to reproduce this, but was unable to.

- Did a quick fresh Drupal 6 install.
- Enabled (installed) Forum module the first time.
- Verified that it's create content menu item is there.
- Disabled the Forum module.
- Verified that it's create content menu item *is NOT* there.
- Enabled the Forum module.
- Verified that it's create content menu item *is* there.

This all looks good to me, no problem on my install.

Gábor Hojtsy’s picture

Version: 5.5 » 6.x-dev
FileSize
11.52 KB
9.24 KB

Well, you gave this issue a misleading title, but reading between the lines, I had an idea to test something else. The actual bug here is that the forum vocabulary has the forum node type removed (through the node type refresh calls in taxonomy_node_type()) when you disable forum module, but then when you enable it, nothing adds it back there. This results in the attached difference in Drupal 6: no vocabulary is associated to the forum node type.

Looking into solving this in some hopefully nice way.

Gábor Hojtsy’s picture

Title: Disabling/enabling Forum module does not put node type back » Enabling forums after being disabled looses vocabulary association
Status: Active » Needs review
FileSize
2.62 KB

Cooked up the attached patch for the problem at hand:

- if there is an existing forums vocabulary when the module is enabled (ie. it was enabled and disabled before), add back the forum node type to the vocabulary (but keep all other possible node types there intact)
- if there is no existing forums vocabulary when enabled, create it just as it was before

I did a small bit of code cleanup here. Noticed that we used to get a list of all vocabularies to check for the form vocabulary while we could just as well try to load that particular one. But then I realized that taxonomy_load_vocabulary() had an E_NOTICE error, so if we call it with a non-existent $vid, it throws a notice (and its return value was not documented). Now it returns FALSE, so we know that the vocabulary was not found.

Tested locally, works for me, solves the problem, even applies a small bit of code cleanup.

Gábor Hojtsy’s picture

FileSize
2.94 KB

On #drupal, closeau noted that the FALSE return value would be an API change, so I made this version to return NULL, as it was before. If you call the taxonomy_vocabulary_load() function with a bugos $vid before the patch, it tries to return $vocabularies[$vid], but as it does not exist, you get a NULL (and a notice). Now after the patch, you get a NULL, but no notice. And also, the database will not be bothered with looking up the bugos vocabulary again, just as before.

keith.smith’s picture

I tested the patch in #6 on a new D6 install by:

confirming the problem with an unpatched copy.
- enabled forum module.
- made some test containers, some test forums, some sample posts.
- confirmed that the Forum topic content type was checked on the Forum vocabulary.
- Disabled the forum module.
- Re-enabled the forum module.
- confirmed that the Forum topic content type was NOT checked on the Forum vocabulary, which is what I understand to be the problem here.

new database, new install, patched copy.
- enabled forum module.
- made some test containers, some test forums, some sample posts.
- confirmed that the Forum topic content type was checked on the Forum vocabulary.
- Disabled the forum module.
- Re-enabled the forum module.
- confirmed that the Forum topic content type WAS checked on the Forum vocabulary, which is the expected behavior.

Also, on a patched copy:
- enabled forum module
- disabled forum module
- deleted Forum vocabulary manually
- re-enabled forum module, and confirmed that Forum vocabulary was recreated correctly.

Edit: I tested the patch in #6.

keith.smith’s picture

I did a roughly equivalent set of steps on a copy patched with the version in #7, and it works as expected. Looks good to go in terms of functionality from a UI point of view, and it definitely preserves the Forum topic association with the forums vocabulary (which an unpatched version of HEAD does not do correctly).

Gábor Hojtsy’s picture

Version: 6.x-dev » 5.x-dev
Status: Needs review » Patch (to be ported)

Great, thanks, I committed #7 to Drupal 6.x-dev then. I also made sure to check for notices of the if ($vocabulary = ...) stuff, when the return value is NULL with this test code:

ini_set('error_reporting', E_ALL);                                                                     
ini_set('display_errors', TRUE);                                                                       
if ($value = NULL) {                                                                                   
  echo 'eh';                                                                                           
}                                                                                                      
echo $not_set;                                                                                         
echo $array['no_value'];                                                                               
echo $red->blue;

This does not trow an E_NOTICE on the if (as expected) but throws notices on the others (as expected). So all seemed to be fine there even.

Moving to the Drupal 5 queue for backporting.

bdragon’s picture

I'm not entirely sure this is relevant for 5.x. I don't think 5.x fourm has an enable hook *at all.*

pwolanin’s picture

subscribe

Gábor Hojtsy’s picture

Well this issue itself was reported originally for 5.x, then moved to 6.x. So this seems to be an applicable issue to 5.x. If the 5.x forum module does not have an enable hook, then this is the time to add one :)

nsk’s picture

Drupal 5.5's forum.install has only install and uninstall hooks: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/forum/forum.instal...

There is no enable hook implementation in Drupal 5.5's forum.install at the moment.

Perhaps it's time to add one for 5.6, though, as Gábor says :) I don't think it will introduce any bugs, and it will fix an issue that may be a headache to sysadmins who cannot upgrade to 6.0.

Gábor Hojtsy’s picture

Erm, no forum enable hook in Drupal 5.x solves upgrade problems... The forum upgrade path already includes any fix which might be needed for forum as far as I know.

drumm’s picture

Priority: Critical » Normal
dejamuse’s picture

I just upgraded to 5.7 and this bug is still there!

If I disable the forum module (for updating Drupal) and then enable it again after the upgrade, the drop down box for "parent" - the forum hierarchy in a new topic post - is gone. I tried the fix posted by langweer which worked when I upgraded to 5.6, but it doesn't seem to work this time.

This is rather critical I would say.

eng.anas’s picture

Version: 5.x-dev » 5.3
Assigned: Unassigned » eng.anas
Priority: Normal » Critical

the same thing happen with me
drop down list didn't appear ... so what should i have to do

eng.anas’s picture

http://drupal.org/node/203399
here is the solution

dejamuse’s picture

Title: Enabling forums after being disabled looses vocabulary association » Enabling forums after being disabled loses vocabulary association

That fix worked going from 5.5 to 5.6 but does not work in 5.7.

I did not have any vocabulary setup to begin with, only the forum list box.

So I tried adding some dummy categories, then disabled the forum module, re-enabled it, noted that none of the previous categories were there, and then added a new category to forums and book page, but now when I try to post a new forum topic I only get the new category drop down box - no forum list and none of the old categories. To get the old categories back I just edit the old categories and re-check the forum box. But if you try to do that with Forum, the check box for Forum Topics is grayed out and checked. Making no changes I submitted the page and it says "An illegal choice has been detected. Please contact the site administrator"

Am I missing something? My site is now broken. HELP!!!!

drumm’s picture

Someone needs to revise the patch in #7 to apply for 5.x. Drupal 5.x does implement hook_enable(), so it should be relatively straightforward.

leop’s picture

As discussed in records in vocabulary_node_types deleted (which now refers here), this problem does not only extend to the forum module, but also to other modules that implement their own content types. As far as I can see, patching the forum module is fighting the symptoms, not the cause.

bdragon’s picture

Version: 5.3 » 5.x-dev
Assigned: eng.anas » Unassigned
Priority: Critical » Normal

Fixing status.

arhak’s picture

Issue tags: +Ancient

tag

Damien Tournoud’s picture

Issue tags: -Ancient

Patches are always welcome. Removing the useless tag.

bdragon’s picture

Status: Patch (to be ported) » Closed (won't fix)

Wontfix for 5 due to EOL.