I used two vocabularies in one node type, one vocabulary is autocategories, and the other is not autocategories.

when I submit the content, autocategories module will remove my other vocabulary terms.

Comments

matslats’s picture

Assigned: Unassigned » matslats
Category: bug » feature

That was a feature worth adding, I think.
Try now

HonorsGrad’s picture

To make sure the module only deletes terms from its own vocab, I altered the code as follows:

**From**

  if (empty($matches)){
    $matches[]=$catch_all_tid;
   // $misc=$node->nid;
  }
  //need to remove all the terms from this vocabulary for this node and resave them
  db_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
  taxonomy_node_save($node, $matches);
}

**To**

  if (empty($matches)){
   $matches[]=$catch_all_tid;
   // $misc=$node->nid;
  }
  $where = '';
	foreach ($terms as $tid=>$term){
		foreach ($term as $synonym){
			$where = $where .','. $tid;
		}
	}
  //need to remove all the terms from this vocabulary for this node and resave them
  db_query('DELETE FROM {term_node} WHERE nid = %d and tid in (0, %d)', $node->nid, $where);
  taxonomy_node_save($node, $matches);
}

I'm sure it isn't the cleanest, but it seems to work.

matslats’s picture

Status: Active » Closed (fixed)

Thanks this was much needed and I've implemented something similar in version 1.3