summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-12-10 19:58:40 +0000
committerDries Buytaert <dries@buytaert.net>2005-12-10 19:58:40 +0000
commit99e27195e8b225e55c61f12d56ed2c0d3d42130e (patch)
tree18bbfce87d24e811d7db679cff2012d18fb0799c
parent810e75050d538419990da7bb795c6ee4afec0302 (diff)
downloadbrdo-99e27195e8b225e55c61f12d56ed2c0d3d42130e.tar.gz
brdo-99e27195e8b225e55c61f12d56ed2c0d3d42130e.tar.bz2
- Patch #40664 by Gerhard: assign default forum when adding a forum topic from within a forum.
-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) {