diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index f89d149..252c023 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1759,19 +1759,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.install b/core/modules/forum/forum.install
index 56f8402..1821987 100644
--- a/core/modules/forum/forum.install
+++ b/core/modules/forum/forum.install
@@ -16,6 +16,21 @@ function forum_install() {
   // @todo Convert to default module configuration, once Node module's content
   //   types are converted.
   variable_set('node_options_forum', array('status'));
+
+  // Enable the forum messages block
+  $block = array(
+    'module' => 'forum',
+    'delta' => 'messages_block',
+    'theme' => variable_get('theme_default'),
+    'status' => 1,
+    'weight' => -100,
+    'region' => 'content',
+    'pages' => '',
+    'cache' => -1,
+  );
+  $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
+  $query->values($block);
+  $query->execute(); 
 }
 
 /**
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 9ec3ec6..4ae88ce 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -83,6 +83,7 @@ function forum_theme() {
       'render element' => 'form',
       'file' => 'forum.admin.inc',
     ),
+    'forum_messages_block' => array(),
   );
 }
 
@@ -162,59 +163,6 @@ function forum_menu() {
 }
 
 /**
- * Implements hook_menu_local_tasks_alter().
- */
-function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
-  global $user;
-
-  // 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) {
-      $links = array();
-      // Loop through all bundles for forum taxonomy vocabulary field.
-      $field = field_info_field('taxonomy_forums');
-      foreach ($field['bundles']['node'] as $type) {
-        if (node_access('create', $type)) {
-          $links[$type] = array(
-            '#theme' => 'menu_local_action',
-            '#link' => array(
-              'title' => t('Add new @node_type', array('@node_type' => node_type_get_label($type))),
-              'href' => 'node/add/' . $type . '/' . $forum_term->tid,
-            ),
-          );
-        }
-      }
-      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),
-            ),
-          );
-        }
-      }
-      $data['actions']['output'] = array_merge($data['actions']['output'], $links);
-    }
-  }
-}
-
-/**
  * Implements hook_entity_info_alter().
  */
 function forum_entity_info_alter(&$info) {
@@ -654,6 +602,9 @@ function forum_block_info() {
     'cache' => DRUPAL_CACHE_CUSTOM,
     'properties' => array('administrative' => TRUE),
   );
+  $blocks['messages_block'] = array(
+    'info' => t('Forum messages'),
+  );
   return $blocks;
 }
 
@@ -661,20 +612,28 @@ function forum_block_info() {
  * Implements hook_block_configure().
  */
 function forum_block_configure($delta = '') {
-  $form['block_' . $delta . '_limit'] = array(
-    '#type' => 'select',
-    '#title' => t('Number of topics'),
-    '#default_value' => config('forum.settings')->get('block.' . $delta . '.limit'),
-    '#options' => drupal_map_assoc(range(2, 20)),
-  );
-  return $form;
+  switch ($delta) {
+    case 'active':
+    case 'new':
+      $form['block_' . $delta . '_limit'] = array(
+        '#type' => 'select',
+        '#title' => t('Number of topics'),
+        '#default_value' => config('forum.settings')->get('block.' . $delta . '.limit'),
+        '#options' => drupal_map_assoc(range(2, 20)),
+      );
+      return $form;
+  }
 }
 
 /**
  * Implements hook_block_save().
  */
 function forum_block_save($delta = '', $edit = array()) {
-  config('forum.settings')->set('block.' . $delta . '.limit', $edit['block_' . $delta . '_limit'])->save();
+  switch ($delta) {
+    case 'active':
+    case 'new':
+      config('forum.settings')->set('block.' . $delta . '.limit', $edit['block_' . $delta . '_limit'])->save();
+  }
 }
 
 /**
@@ -685,30 +644,35 @@ function forum_block_save($delta = '', $edit = array()) {
  */
 function forum_block_view($delta = '') {
   $config = config('forum.settings');
-  $query = db_select('forum_index', 'f')
-    ->fields('f')
-    ->addTag('node_access')
-    ->addMetaData('base_table', 'forum_index');
   switch ($delta) {
     case 'active':
-      $title = t('Active forum topics');
-      $query
-        ->orderBy('f.last_comment_timestamp', 'DESC')
-        ->range(0, $config->get('block.active.limit'));
-      break;
-
     case 'new':
-      $title = t('New forum topics');
-      $query
-        ->orderBy('f.created', 'DESC')
-        ->range(0, $config->get('block.new.limit'));
+      $query = db_select('forum_index', 'f')
+        ->fields('f')
+        ->addTag('node_access')
+        ->addMetaData('base_table', 'forum_index');
+      if ($delta == 'active') {
+        $title = t('Active forum topics');
+        $query
+          ->orderBy('f.last_comment_timestamp', 'DESC')
+          ->range(0, $config->get('block.active.limit'));
+      }
+      else {
+        $title = t('New forum topics');
+        $query
+          ->orderBy('f.created', 'DESC')
+          ->range(0, $config->get('block.new.limit'));
+      }
+      $block['subject'] = $title;
+      // Cache based on the altered query. Enables us to cache with node access enabled.
+      $block['content'] = drupal_render_cache_by_query($query, 'forum_block_view');
+      $block['content']['#access'] = user_access('access content');
+      break;
+    case 'messages_block':
+      $block['subject'] = t('');
+      $block['content'] = theme('forum_messages_block');      
       break;
   }
-
-  $block['subject'] = $title;
-  // Cache based on the altered query. Enables us to cache with node access enabled.
-  $block['content'] = drupal_render_cache_by_query($query, 'forum_block_view');
-  $block['content']['#access'] = user_access('access content');
   return $block;
 }
 
@@ -1421,3 +1385,49 @@ function forum_rdf_mapping() {
     ),
   );
 }
+
+function theme_forum_messages_block() {
+  global $user;
+  $content = NULL;
+  $router_item = menu_get_item();
+  // Add link to 'node/add/forum' on 'forum' sub-pages.
+  if ($router_item['path'] == 'forum' || $router_item['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) {
+      // Loop through all bundles for forum taxonomy vocabulary field.
+      $field = field_info_field('taxonomy_forums');
+      foreach ($field['bundles']['node'] as $type) {
+        if (node_access('create', $type)) {
+          $content = t('<a href="@url">Add new @node_type</a>', array(
+              '@url' => '/node/add/' . $type . '/' . $forum_term->tid, 
+              '@node_type' => node_type_get_label($type))
+          );
+        }
+      }
+      if (!$content) {
+        // Authenticated user does not have access to create new topics.
+        if ($user->uid)
+          $content = t('You are not allowed to post new content in the forum.');
+        else {
+          // Anonymous user does not have access to create new topics.
+          if (!user_role_has_permission(0, 'create forum content')) {
+            // If authenticated users can post new topic, provide a login/register link.
+            if (user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'create forum content')) {
+              $destination = drupal_get_destination();
+              if (config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
+                // Users can register themselves.
+                $content = t('<a href="@login">Log in</a> or <a href="@register">register</a> to post new content in the forum.', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
+              }
+              else {
+                // Only admins can add new users, no public registration.
+                $content = t('<a href="@login">Log in</a> to post new content in the forum.', array('@login' => url('user/login', array('query' => drupal_get_destination()))));
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return $content;
+}
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..0c819cf
--- /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.');
+  }
+}
\ No newline at end of file
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 285b9a7..688462f 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -416,6 +416,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
