Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.605
diff -u -p -r1.605 comment.module
--- modules/comment/comment.module	8 Dec 2007 14:06:21 -0000	1.605
+++ modules/comment/comment.module	8 Dec 2007 18:51:16 -0000
@@ -1627,6 +1627,8 @@ function theme_comment_thread_expanded($
  */
 function theme_comment_post_forbidden($node) {
   global $user;
+  static $authenticated_post_comments;
+  
   if ($user->uid) {
     return t("you can't post comments");
   }
@@ -1639,11 +1641,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, array_merge(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))));
+      }
     }
   }
 }
