If forum nodes can be tag with terms in addition to those in the Forum vocabulary, then a bug manifest as follows:

Edit an existing forum topic. Change the the non-forum taxnomy categories and choose "leave a shadow copy". regardeless of whether the forum topic is actually being moved, the changes to the non-forum taxonomy will be discarded due to faulty logic in forum_submit. Note that all the taxonomy terms are replaced by what's loaded from {term_node} via the call to taxonomy_node_get_terms.

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

  if ($node->taxonomy) {
    // Extract the node's proper topic ID.
    $vocabulary = variable_get('forum_nav_vocabulary', '');
    foreach ($node->taxonomy as $term) {
      if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
        $node->tid = $term;
      }
    }
    if ($node->tid && $node->shadow) {
      // A shadow copy needs to be created. Retain existing term and add new term.
      $terms = array_keys(taxonomy_node_get_terms($node->nid));
      if (!in_array($node->tid, $terms)) {
        $terms[] = $node->tid;
      }
      $node->taxonomy = $terms;
    }
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

Status: Active » Needs review
FileSize
1.67 KB

Attached patch substantially changes the logic of this function. Seems to correct this defect. Please review!

pwolanin’s picture

FileSize
1.63 KB

Pacth applies to 4.7 as well- attached patch is against 4-7-CVS for convenience

beginner’s picture

Status: Needs review » Reviewed & tested by the community

I reproduced the problem, which the patch fixed, without any adverse effect.
The code looks ok to me, too.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

killes@www.drop.org’s picture

backported to 4.7

Anonymous’s picture

Status: Fixed » Closed (fixed)