Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | forum_shadow_patch_47_2.txt | 1.63 KB | pwolanin |
#1 | forum_shadow_patch_HEAD_1.txt | 1.67 KB | pwolanin |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedAttached patch substantially changes the logic of this function. Seems to correct this defect. Please review!
Comment #2
pwolanin CreditAttribution: pwolanin commentedPacth applies to 4.7 as well- attached patch is against 4-7-CVS for convenience
Comment #3
beginner CreditAttribution: 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 CreditAttribution: killes@www.drop.org commentedbackported to 4.7
Comment #6
(not verified) CreditAttribution: commented