Same name and namespace in other branches
  1. 4.6.x modules/comment.module \theme_comment_post_forbidden()
  2. 5.x modules/comment/comment.module \theme_comment_post_forbidden()
  3. 6.x modules/comment/comment.module \theme_comment_post_forbidden()
  4. 7.x modules/comment/comment.module \theme_comment_post_forbidden()

File

modules/comment.module, line 1600
Enables users to comment on published content.

Code

function theme_comment_post_forbidden($nid) {
  global $user;
  if ($user->uid) {
    return t("you can't post comments");
  }
  else {

    // we cannot use drupal_get_destination() because these links sometimes appear on /node and taxo listing pages
    if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
      $destination = "destination=" . drupal_urlencode("comment/reply/{$nid}#comment_form");
    }
    else {
      $destination = "destination=" . drupal_urlencode("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' => check_url(url('user/login', $destination)),
        '%register' => check_url(url('user/register', $destination)),
      ));
    }
    else {
      return t('<a href="%login">login</a> to post comments', array(
        '%login' => check_url(url('user/login', $destination)),
      ));
    }
  }
}