Предполагается, что вы используете Drupal 6, код, который создает форму комментариев, находится в файле comments.module в каталоге модуля Drupal.К счастью, функция позволяет создавать темы.
Что вы можете сделать, это скопировать и вставить функцию theme_comment_post_forbidden ($ node) и поместить ее в файл template.php в каталоге вашей темы.Вам также нужно будет переименовать функцию, заменив «theme» на имя вашей темы.
Например, скажите, что ваша тема называется «utilitiesindia».Затем вы переименуете свою функцию в utilitiesindia_comment_post_forbidden.
Итак, в вашем файле template.php в теме с именем utilitiesindia используйте эту функцию:
/**
* Theme a "you can't post comments" notice.
*
* @param $node
* The comment node.
* @ingroup themeable
*/
function utiltiesindia_comment_post_forbidden($node) {
global $user;
static $authenticated_post_comments;
if (!$user->uid) {
if (!isset($authenticated_post_comments)) {
// We only output any link if we are certain, that users get permission
// to post comments by logging in. We also locally cache this information.
$authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
}
if ($authenticated_post_comments) {
// We cannot use drupal_get_destination() because these links
// sometimes appear on /node and taxonomy listing pages.
if (variable_get('comment_form_location_'. $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$destination = 'destination='. rawurlencode("comment/reply/$node->nid#comment-form");
}
else {
$destination = 'destination='. rawurlencode("node/$node->nid#comment-form");
}
if (variable_get('user_register', 1)) {
// Users can register themselves.
return t('<a href="@login">Login</a> or <a href="@register">register</a> to post comments(comments will be moderated)', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))
);
}
else {
// Only admins can add new users, no public registration.
return t('<a href="@login">Login</a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
}
}
}
}