Invalid argument supplied for foreach() og_forum on line 1141

I'm running Drupal 5.7, og_forum-5.x-2.x-dev, og 5.x-7.3 with the added lines copied from the og_forum README file, ACL 5.x-1.6, Forum Access 5.x-1.10

While in forums as an authenticated user, when I select "Post new forum topic", I get:

warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/og_forum/og_forum.module on line 1141.

The Forums dropdown box is replaced with Categories, but there is nothing to chose from.

As administrator, I do not get the warning, but the Forums dropdown box is replaced with Categories and there is nothing to chose from.

Similarly, from "Add content," "Submit Forum topic" I do not get the warning, but there are no Categories to chose from.

At http://test.nccommunities.org/admin/content/taxonomy, I have forums and "list terms" lists my forums.

og_forum used to work (I installed it in April 2007), but I had problems with private forums and upgraded.
With 5.x-2.1 I was getting:
"warning: Invalid argument supplied for foreach() in /home/drupal/public_html/sites/all/modules/og_forum/og_forum.module on line 748"

I upgraded to og_forum-5.x-2.x-dev.

I did not notice the need for the forum_access and ACL modules until the last few days. I installed them but wonder if I didn't get things messed up by not having them in sooner.

??? Should I uninstall og_forum and reinstall???
----------------------------------------------------
More information:

Looking at http://drupal.org/node/175364 -- I have categories installed but not enabled.
I added at the top of the og_forum_form_alter function:

drupal_set_message('Taxonomy Options X: ' .print_r($form['taxonomy'][$vid]['#options'], TRUE). '');

"Taxonomy Options X:"
now displays before
"warning: Invalid argument supplied for foreach() in /home/drupal2/public_html/sites/all/modules/og_forum/og_forum.module on line 1144."
So it looks like $form['taxonomy'][$vid]['#options'] is empty, but I don't know what is wrong with my setup, since og forums used to work.

I compared the code in og_forums.module (5.x-2.x-dev) with http://drupal.org/files/issues/og_forum_issue_169892.patch.txt and they don't look the same. I tried to apply that patch and got:

patching file og_forum.module
Hunk #1 FAILED at 1.
patch: **** malformed patch at line 19: $all_results[$option_key] == 0) {

I made the changes manually and got:
warning: Invalid argument supplied for foreach() in /home/drupal2/public_html/sites/all/modules/og_forum/og_forum.module on line 1140.

I don't know php or MySQL but I have a good book and a friend who can help.

I haven't uninstalled anything before, but I think that might be the best way to clean out whatever this problem is. What do you think?

Comments

hallman’s picture

I have a similar problem when og_forum is disabled, I don't get a selection dropdown list for selecting a parent forum for a new topic -- see http://drupal.org/node/281851

I think there's something messed up in my database. In og_forum, how does $form['taxonomy'][$vid]['#options'] get set?

Judy Hallman

hallman’s picture

I found the problem. On all my sites that had problems, the table vocabulary_node_types was messed up. In most cases it was empty. In one case, the image row was there but the forum row was not. I inserted values in vocabulary_node_types and my sites are working again. I'm not going to try to figure out what emptied the table.

Judy Hallman