This is a problem I've been trying to figure out for a while, but have gotten almost nowhere. For starters, I am using PostgreSQL in case that is an issue. In any case, when I create a forum topic using the link in that forum, the tid is not recorded when the topic is created. Thus, the topic is created with a tid of 0 and doesn't appear in any forum. I fixed this issue by adding the following code to the top of the "forum_validate" function.

if (!$node->nid) {
    // new topic
    $node->taxonomy[] = arg(3);
  }
  else {
    $node->taxonomy = array($node->tid);
  }

This takes care of adding topics to forums using the link on the forum page. It is just a little hack for now and is not meant to fix the core issue.

Unfortunately, the taxonomy selector is still not shown and if the user selects "forum topic" from the "create content" menu, they may create a forum topic that isn't in a forum. This may stem from a PostgreSQL issue with the taxonomy module. This seems to be an issue with any module that deals with it's own "private" taxonomy, as in the forum module and the new image module.

CommentFileSizeAuthor
#1 taxonomy_6.patch468 bytesAnonymous (not verified)

Comments

Anonymous’s picture

Component: forum.module » taxonomy.module
StatusFileSize
new468 bytes

I found a solution that worked for me, although it sounds as if this problem has been unique to my setup. Maybe it's Postgres, I don't know. Anyhow, I found that the query in taxonomy_node_form SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name returns nothing. I figured that this should probably return something, especially when you're trying to insert a node into a taxonomy tree. I replaced the code with SELECT n.*, v.weight, v.name FROM {vocabulary_node_types} n LEFT JOIN {vocabulary} v ON n.vid = v.vid WHERE n.type = '%s' ORDER BY v.weight, v.name. This joins all the vocab node types with their respective vocabularies if they exist. Since the privately controlled vocabularies don't have a 'required' selector either, I figured it would be a good idea to make it default for remotely controlled taxonomies to be required. I replaced if ($vocabulary->required) with if (!isset($vocabulary->required) || $vocabulary->required) which checks if required is even set. I hope this patch actually does something useful for someone else too. It also fixed the problems I've been having with the new image module.

dodobas’s picture

this is helpful, very.

but why isn't commited to HEAD, without it forums are completely useless...

adrian’s picture

I haven't been able to reproduce this bug at all. How does it occur?

dodobas’s picture

well i am also using postgres, and after setting up forums (containers and actual forums), the following query returns 0 results
SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name
So when i try to post a topic on some forum, it does not show up as posted on a forum, it does get posted but not on a forum, while the following query
SELECT n.*, v.weight, v.name FROM {vocabulary_node_types} n LEFT JOIN {vocabulary} v ON n.vid = v.vid WHERE n.type = '%s' ORDER BY v.weight, v.name
returns exactly what is needed, and while posting i get 'forums selector' choosebox.

To resolve this i have used taxonomy_6.patch because without forums and possibly other taxonomy related stuff is useless.

I've tried different verison of drupal46 (cvs) on more then one mashine, and the problem persists, i could try to use mysql for testing purposes only, and see is this issue database related...

dodobas’s picture

well the problem was resolved in 4.6 FInal verison.

The main cause for this problem was wrong syntax for INSERT INTO vocabulary ... in Postgres, standard warning: pg_query(): Query failed: ERROR: invalid input syntax for integer: "" that fired up while inserting into vocabulary table. The value of weight was not properly set, following line in taxonomy.module fixed that

122: $edit['weight'] = ($edit['weight']) ? $edit['weight'] : 0;

Well. thx...

dries’s picture

dietcoke’s picture

Well, 4.6.0 has not fixed perfectly. Please check http://drupal.org/node/20747

bobcat’s picture

Sorry if I'm dense, but can someone condense the above info into a working patch or readable bit of info so I can fix my new and clean drupal 4.6.0 install?

Reading above it appears several approaches to the problem were tried, and I'm not sure what actually fixes the forum/taxonomy problem.

But I do know that the released 4.6.0 is badly broken, just as described above.

bobcat’s picture

Title: Create forum topic not inserting in forum » Create forum topicpatches not inserting in forum

I put patch 6 in as above and it had no effect. Forums are still marked with a tid of 0. Posts to vocabulary terms still do not show up in the forums. I'm using mysql.

sas789’s picture

As per bobcat's post above, it seems the patch only works for PostgreSQL. Could someone please provide a fix for MySQL, or point me in the right direction so I can try to figure it out? Thanks.

chx’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)