summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/forum.module16
-rw-r--r--modules/forum/forum.module16
2 files changed, 22 insertions, 10 deletions
diff --git a/modules/forum.module b/modules/forum.module
index 7e36b4087..3aae6b469 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -587,11 +587,7 @@ function forum_update($node) {
function forum_form(&$node) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $node->title, '#required' => TRUE);
- if (!$node->nid) {
- // new topic
- $node->taxonomy[] = arg(3);
- }
- else {
+ if ($node->nid) {
$forum_terms = taxonomy_node_get_terms_by_vocabulary(_forum_get_vid(), $node->nid);
// if editing, give option to leave shadows
$shadow = (count($forum_terms) > 1);
@@ -606,6 +602,16 @@ function forum_form(&$node) {
}
/**
+ * Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum.
+ */
+function forum_prepare(&$node) {
+ if (!$node->nid) {
+ // new topic
+ $node->taxonomy[] = arg(3);
+ }
+}
+
+/**
* Implementation of hook_insert().
*/
function forum_insert($node) {
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 7e36b4087..3aae6b469 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -587,11 +587,7 @@ function forum_update($node) {
function forum_form(&$node) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $node->title, '#required' => TRUE);
- if (!$node->nid) {
- // new topic
- $node->taxonomy[] = arg(3);
- }
- else {
+ if ($node->nid) {
$forum_terms = taxonomy_node_get_terms_by_vocabulary(_forum_get_vid(), $node->nid);
// if editing, give option to leave shadows
$shadow = (count($forum_terms) > 1);
@@ -606,6 +602,16 @@ function forum_form(&$node) {
}
/**
+ * Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum.
+ */
+function forum_prepare(&$node) {
+ if (!$node->nid) {
+ // new topic
+ $node->taxonomy[] = arg(3);
+ }
+}
+
+/**
* Implementation of hook_insert().
*/
function forum_insert($node) {