summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-08-05 01:42:56 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-08-05 01:42:56 +0000
commit5c57a53165f4300e90c230451663165194d0b842 (patch)
treef305dd954af9833ae5eefbfa8752bae1083c9da8 /modules
parent651a42b9c2c70ae5fe9f664d04067c8d51ef10bf (diff)
downloadbrdo-5c57a53165f4300e90c230451663165194d0b842.tar.gz
brdo-5c57a53165f4300e90c230451663165194d0b842.tar.bz2
#76339 by pwolanin, allow non-forum category changes while leaving a shadow copy
Diffstat (limited to 'modules')
-rw-r--r--modules/forum/forum.module22
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 376c31512..d6c2f0e8e 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -323,20 +323,24 @@ function forum_submit(&$node) {
$node->icon = $node->icon ? $node->icon : '';
if ($node->taxonomy) {
- // Extract the node's proper topic ID.
- $vocabulary = variable_get('forum_nav_vocabulary', '');
+ // Get the forum terms from the (cached) tree
+ $tree = taxonomy_get_tree(_forum_get_vid());
+ if ($tree) {
+ foreach ($tree as $term) {
+ $forum_terms[] = $term->tid;
+ }
+ }
foreach ($node->taxonomy as $term) {
- if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
+ if (in_array($term, $forum_terms)) {
$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;
+ $old_tid = db_result(db_query_range("SELECT tid FROM {forum} WHERE nid = %d ORDER BY vid DESC", $node->nid, 0,1));
+ if ($old_tid) {
+ if (($node->tid != $old_tid) && $node->shadow) {
+ // A shadow copy needs to be created. Retain new term and add old term.
+ $node->taxonomy[] = $old_tid;
}
- $node->taxonomy = $terms;
}
}
}