Commit 99e27195 authored by Dries's avatar Dries
Browse files

- Patch #40664 by Gerhard: assign default forum when adding a forum topic from within a forum.

parent 810e7505
......@@ -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);
......@@ -605,6 +601,16 @@ function forum_form(&$node) {
return $form;
}
/**
* 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().
*/
......
......@@ -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);
......@@ -605,6 +601,16 @@ function forum_form(&$node) {
return $form;
}
/**
* 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().
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment