[drupal-devel] [bug] Create forum topic not inserting in forum

dodobas drupal-devel at drupal.org
Thu Apr 14 05:51:36 UTC 2005

Issue status update for http://drupal.org/node/19562

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  joe at www.joepilot.net
 Reported by:  joe at www.joepilot.net
 Updated by:   dodobas
 Status:       patch

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,
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...


Previous comments:

March 28, 2005 - 01:41 : joe at www.joepilot.net

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.


March 28, 2005 - 17:20 : Anonymous

Attachment: http://drupal.org/files/issues/taxonomy_6.patch (468 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.


April 13, 2005 - 15:11 : dodobas

this is helpful, very.

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


April 14, 2005 - 01:06 : adrian

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

More information about the drupal-devel mailing list