theme_comment_post_forbidden

Definition

theme_comment_post_forbidden($nid)
comment/comment.module, line 1809

Code

<?php
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' => url('user/login', $destination), '@register' => url('user/register', $destination)));
    }
    else {
      return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', $destination)));
    }
  }
}
?>