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;
}
}
}
Comments
Comment #1
pwolanin commentedAttached patch substantially changes the logic of this function. Seems to correct this defect. Please review!
Comment #2
pwolanin commentedPacth applies to 4.7 as well- attached patch is against 4-7-CVS for convenience
Comment #3
beginner commentedI reproduced the problem, which the patch fixed, without any adverse effect.
The code looks ok to me, too.
Comment #4
drummCommitted to HEAD.
Comment #5
killes@www.drop.org commentedbackported to 4.7
Comment #6
(not verified) commented