Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
99e27195
Commit
99e27195
authored
Dec 10, 2005
by
Dries
Browse files
- Patch
#40664
by Gerhard: assign default forum when adding a forum topic from within a forum.
parent
810e7505
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/forum.module
View file @
99e27195
...
...
@@ -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().
*/
...
...
modules/forum/forum.module
View file @
99e27195
...
...
@@ -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().
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment