You are here

function theme_comment_post_forbidden in Drupal 4

Same name and namespace in other branches
  1. 5 modules/comment/comment.module \theme_comment_post_forbidden()
  2. 6 modules/comment/comment.module \theme_comment_post_forbidden()
  3. 7 modules/comment/comment.module \theme_comment_post_forbidden()
2 theme calls to theme_comment_post_forbidden()
comment_link in modules/comment.module
Implementation of hook_link().
comment_links in modules/comment.module

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)),
      ));
    }
  }
}