theme_comment_post_forbidden

Versions
4.6
theme_comment_post_forbidden()
4.7 – 5
theme_comment_post_forbidden($nid)
6
theme_comment_post_forbidden($node)
7
theme_comment_post_forbidden($variables)

Code

modules/comment.module, line 1600

<?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' => 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))));
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.