Greetings,

After upgrading to Drupal 5.2 (and having Category module installed) all the new topics that I post say "this topic has been moved" when I go to the forum. When I look in the table `forum`, the `tid` is always set to 0.

It seems that $node->taxonomy isn't getting picked up in the forum_submit function. In the following function, the if ($node->taxonomy) doesn't match.

function forum_submit(&$node) {
  // Make sure all fields are set properly:
  $node->icon = !empty($node->icon) ? $node->icon : '';

  if ($node->taxonomy) {
    // Get the forum terms from the (cached) tree
    $tree = taxonomy_get_tree(_forum_get_vid());

If I manually set $node->tid = 41 above the if ($node->taxonomy) statement, the topic appears in the correct forum without "this topic has been moved" thing.

Seems like $node->taxonomy isn't getting picked up somewhere.. maybe it's outside of this module?

Any ideas?

Thanks,
Andrey.

Comments

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)

Suggestion: Empty the cache_* tables.

Did you execute the upgrade.php?

mr.andrey’s picture

Just cleared the cache* tables:

TRUNCATE `cache`;
TRUNCATE `cache_filter`;
TRUNCATE `cache_menu`;
TRUNCATE `cache_page`;
TRUNCATE `cache_views`;

upgrade.php? I executed update.php, is there upgrade.php that I need to run?

Still experiencing this problem.

Thanks,
Andrey.

mr.andrey’s picture

Project: Drupal core » Category
Version: 5.2 » 5.x-1.x-dev
Component: forum.module » Wrapper modules
Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

It seems that $node->taxonomy is empty, but if I set it to equal $node->category, everything works.

function forum_submit(&$node) {
  // Make sure all fields are set properly:
  $node->icon = !empty($node->icon) ? $node->icon : '';

  $node->taxonomy = $node->category;
  if ($node->taxonomy) {

This seems more like Category problem rather than Forum module, so I will move it there.

At which point does Category set the $node->taxonomy while inserting a new forum topic?

Is it this?

    case 'insert':
      if (category_is_cat_or_cont($node->nid)) {
        $type = category_node_get_type($node);
        $is_cat = $type == 'category_cat';
        if ($is_cat) {
          taxonomy_save_term($edit = _taxonomy_prepare_edit_term($node), TRUE, $node$
        }
        else {
          taxonomy_save_vocabulary($edit = _taxonomy_prepare_edit_vocabulary($node),$
        }
      }
/* --- $node->taxonomy here is not empty --- */
      if (empty($node->taxonomy)) {
        if (!empty($node->category)) {
          $node->taxonomy = _taxonomy_categories_into_terms($node->category);
        }
        else {
          $node->taxonomy = taxonomy_node_get_terms($node->nid);
        }
      }
      taxonomy_node_save($node->nid, $node->taxonomy, $node);
      break;                                         

Any ideas?

Thanks,
Andrey.

JirkaRybka’s picture

Not sure whether this is related or not, but look at this: http://drupal.org/node/117172

Using the patches from that Issue allowed me to use Forum with Category on production site, seems to be OK , active for weeks now.

mr.andrey’s picture

wohoo! it worked, the two patches did the trick:

http://drupal.org/files/issues/forum_compat.patch - this fixed the default forum problem
http://drupal.org/files/issues/validationtry2.patch - this fixed the $node->taxonomy tid=0 problem

Thanks!
Andrey.

dakku’s picture

I am having the same issue, posts by registered members are not getting the correct tid in the forum table! Any ideas?