Drupal Answers Asked by Dominick on October 26, 2021
My goal is to create a second forum. I created a new content type called forum2 and added taxonomy_forums term reference to it.
Drupal automatically creates links for each content type.
I would like to display links based on the forum topics.
For example ,
namesite/forum/1 – only New topic link is visible
namesite/forum/4 – only link for forum2 is visible
and so on.
here is what I did
function theme_advanced_forum_node_type_create_list(&$variables) {
$forum_id = $variables['forum_id'];
// Get the list of node types to display links for.
$type_list = advanced_forum_node_type_create_list($forum_id);
$output = '';
if ($forum_id == 1 || $forum_id == 2) {
$output .= '<div class="forum-add-node forum-add-forum">';
$output .= theme('advanced_forum_l', array(
'text' => 'Add to forum',
'path' => $type_list['forum']['href'],
'options' => NULL,
'button_class' => 'large',
));
$output .= '</div>';
}
elseif ($forum_id == 3 || $forum_id == 4) {
$output .= '<div class="forum-add-node forum-add-forum2">';
$output .= theme('advanced_forum_l', array(
'text' => 'Add to forum2',
'path' => $type_list['forum2']['href'],
'options' => NULL,
'button_class' => 'large',
));
$output .= '</div>';
}
else {
// User did not have access to create any node types in this fourm so
// we just return the denial text / login prompt.
$output = $type_list;
}
return $output;
}
Any help would be greatly appreciated
I got it working. Here is the code
function theme_advanced_forum_node_type_create_list(&$variables) {
$forum_id = $variables['forum_id'];
// Get the list of node types to display links for.
$type_list = advanced_forum_node_type_create_list($forum_id);
$forum_ids = array(1,2,3,4); // Ids of forum1
$forum2_ids = array(5,6,7,8,9,10); // Ids of forum2
$output = '';
if (in_array($forum_id, $forum_ids)) {
$output .= '<div class="forum-add-node forum-add-forum">';
$output .= theme('advanced_forum_l', array(
'text' => 'New topic',
'path' => $type_list['forum']['href'],
'options' => NULL,
'button_class' => 'large',
));
$output .= '</div>';
}
elseif (in_array($forum_id, $forum2_ids)) {
$output .= '<div class="forum-add-node forum-add-forum2">';
$output .= theme('advanced_forum_l', array(
'text' => 'New topic',
'path' => $type_list['forum2']['href'],
'options' => NULL,
'button_class' => 'large',
));
$output .= '</div>';
}
else {
// User did not have access to create any node types in this fourm so
// we just return the denial text / login prompt.
$output = $type_list;
}
return $output;
}
Answered by Dominick on October 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP