Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.610
diff -u -p -r1.610 comment.module
--- modules/comment/comment.module	19 Dec 2007 21:40:05 -0000	1.610
+++ modules/comment/comment.module	22 Dec 2007 22:18:04 -0000
@@ -1761,10 +1761,9 @@ function theme_comment_thread_expanded($
  */
 function theme_comment_post_forbidden($node) {
   global $user;
-  if ($user->uid) {
-    return t("you can't post comments");
-  }
-  else {
+  static $authenticated_post_comments;
+  
+  if (!$user->uid) {
     // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages
     if (variable_get('comment_form_location_'. $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
       $destination = "destination=". drupal_urlencode("comment/reply/$node->nid#comment-form");
@@ -1773,11 +1772,16 @@ function theme_comment_post_forbidden($n
       $destination = "destination=". drupal_urlencode("node/$node->nid#comment-form");
     }
 
-    if (variable_get('user_register', 1)) {
-      return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
+    if (!isset($authenticated_post_comments)) {
+      $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
     }
-    else {
-      return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
+    if ($authenticated_post_comments) {
+      if (variable_get('user_register', 1)) {
+        return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
+      }
+      else {
+        return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
+      }
     }
   }
 }
