summaryrefslogtreecommitdiff
path: root/modules/forum
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-27 02:59:31 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-27 02:59:31 +0000
commit9ce07179a37f606891ee91e141ee38681d9190d0 (patch)
tree68537908b83c6e8282a34f280acbfed0743419b6 /modules/forum
parent74923f7091a333628188ee2c1cbbba1963e1dc8d (diff)
downloadbrdo-9ce07179a37f606891ee91e141ee38681d9190d0.tar.gz
brdo-9ce07179a37f606891ee91e141ee38681d9190d0.tar.bz2
#786620 by mradcliffe, joachim, andypost: Regression: Add new forum topic not visible within a forum.
Diffstat (limited to 'modules/forum')
-rw-r--r--modules/forum/forum.module8
-rw-r--r--modules/forum/forum.test10
2 files changed, 14 insertions, 4 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index ed7129c81..f5d779a91 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -165,9 +165,9 @@ function forum_menu() {
function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
global $user;
- // Add action link to 'node/add/forum' on 'forum' page.
- if ($root_path == 'forum') {
- $tid = (isset($router_item['page_arguments'][0]) ? $router_item['page_arguments'][0] : 0);
+ // Add action link to 'node/add/forum' on 'forum' sub-pages.
+ if ($root_path == 'forum' || $root_path == 'forum/%') {
+ $tid = (isset($router_item['page_arguments'][0]) ? $router_item['page_arguments'][0]->tid : 0);
$forum_term = forum_forum_load($tid);
if ($forum_term) {
$vid = variable_get('forum_nav_vocabulary', 0);
@@ -601,7 +601,7 @@ function forum_form_alter(&$form, $form_state, $form_id) {
$form['advanced']['parent']['#access'] = FALSE;
}
}
- if ($form_id == 'forum_node_form') {
+ if (!empty($form['#node_edit_form']) && isset($form['taxonomy_forums'])) {
$langcode = $form['taxonomy_forums']['#language'];
// Make the vocabulary required for 'real' forum-nodes.
$form['taxonomy_forums'][$langcode]['#required'] = TRUE;
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 110dc3267..18b61d050 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -64,6 +64,10 @@ class ForumTestCase extends DrupalWebTestCase {
// Login an unprivileged user to view the forum topics and generate an
// active forum topics list.
$this->drupalLogin($this->web_user);
+ // Verify that this user is shown a message that they may not post content.
+ $this->drupalGet('forum/' . $this->forum['tid']);
+ $this->assertText(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect.");
+
$this->viewForumTopics($this->nids);
// Log in, and do basic tests for a user with permission to edit any forum
@@ -80,6 +84,12 @@ class ForumTestCase extends DrupalWebTestCase {
// Verify that this user cannot edit forum content authored by another user.
$this->verifyForums($this->edit_any_topics_user, $any_topics_user_node, FALSE, 403);
+ // Verify that this user is shown a local task to add new forum content.
+ $this->drupalGet('forum');
+ $this->assertLink(t('Add new Forum topic'));
+ $this->drupalGet('forum/' . $this->forum['tid']);
+ $this->assertLink(t('Add new Forum topic'));
+
// Login a user with permission to edit any forum content.
$this->drupalLogin($this->edit_any_topics_user);
// Verify that this user can edit forum content authored by another user.