diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index ab757a9..2f21af4 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1745,19 +1745,10 @@ function theme_comment_post_forbidden($variables) {
   $node = $variables['node'];
   global $user;
 
-  // Since this is expensive to compute, we cache it so that a page with many
-  // comments only has to query the database once for all the links.
-  $authenticated_post_comments = &drupal_static(__FUNCTION__, NULL);
-
   if (!$user->uid) {
-    if (!isset($authenticated_post_comments)) {
-      // We only output a link if we are certain that users will get permission
-      // to post comments by logging in.
-      $comment_roles = user_roles(TRUE, 'post comments');
-      $authenticated_post_comments = isset($comment_roles[DRUPAL_AUTHENTICATED_RID]);
-    }
-
-    if ($authenticated_post_comments) {
+    // We only output a link if we are certain that users will get permission
+    // to post comments by logging in.
+    if (user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'post comments')) {
       // We cannot use drupal_get_destination() because these links
       // sometimes appear on /node and taxonomy listing pages.
       if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW) == COMMENT_FORM_SEPARATE_PAGE) {
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 9ec3ec6..4ae8041 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -61,7 +61,7 @@ function forum_theme() {
   return array(
     'forums' => array(
       'template' => 'forums',
-      'variables' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
+      'variables' => array('access_error' => NULL, 'forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
     ),
     'forum_list' => array(
       'template' => 'forum-list',
@@ -186,30 +186,37 @@ function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
           );
         }
       }
-      if (empty($links)) {
-        // Authenticated user does not have access to create new topics.
-        if ($user->uid) {
-          $links['disallowed'] = array(
-            '#theme' => 'menu_local_action',
-            '#link' => array(
-              'title' => t('You are not allowed to post new content in the forum.'),
-            ),
-          );
-        }
-        // Anonymous user does not have access to create new topics.
-        else {
-          $links['login'] = array(
-            '#theme' => 'menu_local_action',
-            '#link' => array(
-              'title' => t('<a href="@login">Log in</a> to post new content in the forum.', array(
-                '@login' => url('user/login', array('query' => drupal_get_destination())),
-              )),
-              'localized_options' => array('html' => TRUE),
-            ),
-          );
+      // We only output a link if we are certain that users will get permission
+      // to post new content in the forum by logging in.
+      if (empty($links) && !$user->uid) {
+        // If authenticated users can post new topic, provide a login link.
+        if (user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'create forum content')) {
+          $destination = drupal_get_destination();
+          // Users can register themselves.
+          if (config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
+            $links['login'] = array(
+              '#theme' => 'menu_local_action',
+              '#link' => array(
+                'title' => t('Log in or register to post new content in the forum.'),
+                'href' => 'user',
+                'localized_options' => $destination,
+              ),
+            );
+          }
+          else {
+            // Only admins can add new users, no public registration.
+            $links['login'] = array(
+              '#theme' => 'menu_local_action',
+              '#link' => array(
+                'title' => t('Log in to post new content in the forum.'),
+                'href' => 'user/login',
+                'localized_options' => $destination,
+              ),
+            );
+          }
         }
+        $data['actions']['output'] = array_merge($data['actions']['output'], $links);
       }
-      $data['actions']['output'] = array_merge($data['actions']['output'], $links);
     }
   }
 }
diff --git a/core/modules/forum/forum.pages.inc b/core/modules/forum/forum.pages.inc
index 0f41bd3..8f9ffbb 100644
--- a/core/modules/forum/forum.pages.inc
+++ b/core/modules/forum/forum.pages.inc
@@ -18,6 +18,8 @@
  * @see forum_menu()
  */
 function forum_page($forum_term = NULL) {
+  global $user;
+
   $config = config('forum.settings');
   if (!isset($forum_term)) {
     // On the main page, display all the top-level forums.
@@ -34,5 +36,16 @@ function forum_page($forum_term = NULL) {
     $topics = '';
   }
 
-  return theme('forums', array('forums' => $forum_term->forums, 'topics' => $topics, 'parents' => $forum_term->parents, 'tid' => $forum_term->tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page));
-}
+  // Loop through all bundles for forum taxonomy vocabulary field.
+  $field = field_info_field('taxonomy_forums');
+  $access_error = NULL;
+  foreach ($field['bundles']['node'] as $type) {
+    if (!node_access('create', $type)) {
+      if ($user->uid) {
+        // Authenticated user does not have access to create new topics.
+        $access_error = t('You are not allowed to post new content in the forum.');
+      }
+    }
+  }
+  return theme('forums', array('access_error' => $access_error, 'forums' => $forum_term->forums, 'topics' => $topics, 'parents' => $forum_term->parents, 'tid' => $forum_term->tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page));
+}
\ No newline at end of file
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumAnonymousTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumAnonymousTest.php
new file mode 100644
index 0000000..17c9ccd
--- /dev/null
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumAnonymousTest.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\forum\Tests\ForumAnonymousTest.
+ */
+
+namespace Drupal\forum\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests forum behavior for anonymous users.
+ */
+class ForumAnonymousTest extends WebTestBase {
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('taxonomy', 'comment', 'forum');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Forum anonymous',
+      'description' => 'Tests anonymous user messages.',
+      'group' => 'Forum',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp();
+
+    // Create a test user.
+    $web_user = $this->drupalCreateUser(array(
+      'create forum content',
+      'edit own forum content',
+      'edit any forum content',
+      'administer nodes',
+    ));
+    $this->drupalLogin($web_user);
+  }
+
+  /**
+   * Tests that anonymous users receive correct messages.
+   *
+   * Verfies the presence of message "Log in to post new content in the forum"
+   * when the user is anonymous and the authenticated does not have the "Create
+   * new content" permission.
+   */
+  public function testAnonymousForumMessage() {
+    $langcode = LANGUAGE_NOT_SPECIFIED;
+
+    // The forum ID to use.
+    $tid = 1;
+
+    // Create a test node.
+    $title = $this->randomName(20);
+    $edit = array(
+      'title' => $title,
+      "body[$langcode][0][value]" => $this->randomName(25),
+      "taxonomy_forums[$langcode]" => array(1),
+    );
+
+    // Create the forum topic, preselecting the forum ID via a URL parameter.
+    $this->drupalPost('node/add/forum/' . $tid, $edit, t('Save'));
+    $this->drupalLogout();
+
+    // Access the forum list as an anonymous user and test for presence of
+    // message.
+    $this->drupalGet('forum');
+    $this->assertNoRaw(t('<a href="@login">Log in</a> to post new content in the forum.', array('@login' => url('user/login', array('query' => array('destination' => 'forum'))))), 'Log in or register message does not appear.');
+  }
+}
diff --git a/core/modules/forum/templates/forums.tpl.php b/core/modules/forum/templates/forums.tpl.php
index 6a0e02e..98e5e3f 100644
--- a/core/modules/forum/templates/forums.tpl.php
+++ b/core/modules/forum/templates/forums.tpl.php
@@ -7,6 +7,7 @@
  * May contain forum containers as well as forum topics.
  *
  * Available variables:
+ * - $access_error: Contains a message if user does not have access to post new content
  * - $forums: The forums to display (as processed by forum-list.tpl.php).
  * - $topics: The topics to display (as processed by forum-topic-list.tpl.php).
  * - $forums_defined: A flag to indicate that the forums are configured.
@@ -18,6 +19,7 @@
 ?>
 <?php if ($forums_defined): ?>
 <div id="forum">
+  <?php if ($access_error) print $access_error; ?>
   <?php print $forums; ?>
   <?php print $topics; ?>
 </div>
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 7dabb6d..d0835ee 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -390,7 +390,7 @@ function user_password($length = 10) {
 }
 
 /**
- * Determine the permissions for one or more roles.
+ * Determines the permissions for one or more roles.
  *
  * @param $roles
  *   An array whose keys are the role IDs of interest, such as $user->roles.
@@ -436,6 +436,29 @@ function user_role_permissions($roles = array()) {
 }
 
 /**
+ * Determines the permissions for one or more roles.
+ *
+ * @param string $rid
+ *   Role ID of interest
+ *
+ * @param string $permission
+ *   Permission name, such as "administer nodes"
+ *
+ * @return boolean
+ *   TRUE if the given role has the requested permission.
+ */
+function user_role_has_permission($rid, $permission) {
+  // Get permissions of role given by ID.
+  // @todo: the user_role_permission method asks for rid => name but the name is
+  //   never used, should be improve?!
+  // @todo: should it be possible to handle multiple IDs?
+  $perms = user_role_permissions(array($rid => $rid));
+
+  // Returns TRUE if the role has the requested permission.
+  return isset($perms[$rid][$permission]);
+}
+
+/**
  * Determine whether the user has a given privilege.
  *
  * @param $string
