[drupal-devel] [bug] Create forum topic not inserting in forum
adrian
drupal-devel at drupal.org
Thu Apr 14 00:06:45 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: adrian
Status: patch
I haven't been able to reproduce this bug at all. How does it occur?
adrian
Previous comments:
------------------------------------------------------------------------
March 28, 2005 - 02: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 - 18: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 - 16:11 : dodobas
this is helpful, very.
but why isn't commited to HEAD, without it forums are completely
useless...
More information about the drupal-devel
mailing list