### Eclipse Workspace Patch 1.0 #P drupal-head Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.605 diff -u -r1.605 comment.module --- modules/comment/comment.module 8 Dec 2007 14:06:21 -0000 1.605 +++ modules/comment/comment.module 12 Dec 2007 23:15:02 -0000 @@ -1627,10 +1627,7 @@ */ function theme_comment_post_forbidden($node) { global $user; - if ($user->uid) { - return t("you can't post comments"); - } - else { + 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"); @@ -1639,11 +1636,15 @@ $destination = "destination=". drupal_urlencode("node/$node->nid#comment-form"); } - if (variable_get('user_register', 1)) { - return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); - } - else { - return t('Login to post comments', array('@login' => url('user/login', array('query' => $destination)))); + // Need to retrieve post comment permissions for authenticated-user (rid = 2) + $perm = db_result(db_query("SELECT p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid = 2")); + if (strpos($perm, 'post comments')) { + if (variable_get('user_register', 1)) { + return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); + } + else { + return t('Login to post comments', array('@login' => url('user/login', array('query' => $destination)))); + } } } }