| Versions | |
|---|---|
| 4.7 – 5 | theme_comment_post_forbidden( |
| 6 | theme_comment_post_forbidden( |
| 7 | theme_comment_post_forbidden($variables) |
modules/
<?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))));
}
}
}
?>