Вот вам свежайший практический ответ на вопрос (инструкция)
заходим в /components/com_jcomments/jcomments.ajax.php
находим строку 180 (или около того)
видим код
if (!$user->id) {
$noErrors = false;
if (isset($values['userid']) && intval($values['userid']) > 0) {
// TODO: we need more correct way to detect login timeout
self::showErrorMessage(JText::_('ERROR_SESSION_EXPIRED'));
} else if (($config->getInt('author_name', 2) == 2) && empty($values['name'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_NAME'), 'name');
} else if (JCommentsSecurity::checkIsRegisteredUsername($values['name']) == 1) {
self::showErrorMessage(JText::_('ERROR_NAME_EXISTS'), 'name');
} else if (JCommentsSecurity::checkIsForbiddenUsername($values['name']) == 1) {
self::showErrorMessage(JText::_('ERROR_FORBIDDEN_NAME'), 'name');
} else if (preg_match('/[\"\'\[\]\=\<\>\(\)\;]+/', $values['name'])) {
self::showErrorMessage(JText::_('ERROR_INVALID_NAME'), 'name');
} else if (($config->get('username_maxlength')!= 0)
&& (JCommentsText::strlen($values['name']) > $config->get('username_maxlength'))) {
self::showErrorMessage(JText::_('ERROR_TOO_LONG_USERNAME'), 'name');
} else if (($config->getInt('author_email') == 2) && empty($values['email'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_EMAIL'), 'email');
} else if (!empty($values['email']) && (!preg_match(_JC_REGEXP_EMAIL2, $values['email']))) {
self::showErrorMessage(JText::_('ERROR_INCORRECT_EMAIL'), 'email');
} else if (($config->getInt('author_email')!= 0) && JCommentsSecurity::checkIsRegisteredEmail($values['email']) == 1) {
self::showErrorMessage(JText::_('ERROR_EMAIL_EXISTS'), 'email');
} else if (($config->getInt('author_homepage') == 2) && empty($values['homepage'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_HOMEPAGE'), 'homepage');
} else {
$noErrors = true;
}
if (!$noErrors) {
return $response;
}
}
добавляем строку
} else if (!empty($values['name2'])) {
self::showErrorMessage(JText::_('CAPTCHA'), 'second-name');
}
получается вот так
if (!$user->id) {
$noErrors = false;
if (isset($values['userid']) && intval($values['userid']) > 0) {
// TODO: we need more correct way to detect login timeout
self::showErrorMessage(JText::_('ERROR_SESSION_EXPIRED'));
} else if (($config->getInt('author_name', 2) == 2) && empty($values['name'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_NAME'), 'name');
} else if (!empty($values['name2'])) {
self::showErrorMessage(JText::_('CAPTCHA'), 'second-name');
} else if (JCommentsSecurity::checkIsRegisteredUsername($values['name']) == 1) {
self::showErrorMessage(JText::_('ERROR_NAME_EXISTS'), 'name');
} else if (JCommentsSecurity::checkIsForbiddenUsername($values['name']) == 1) {
self::showErrorMessage(JText::_('ERROR_FORBIDDEN_NAME'), 'name');
} else if (preg_match('/[\"\'\[\]\=\<\>\(\)\;]+/', $values['name'])) {
self::showErrorMessage(JText::_('ERROR_INVALID_NAME'), 'name');
} else if (($config->get('username_maxlength')!= 0)
&& (JCommentsText::strlen($values['name']) > $config->get('username_maxlength'))) {
self::showErrorMessage(JText::_('ERROR_TOO_LONG_USERNAME'), 'name');
} else if (($config->getInt('author_email') == 2) && empty($values['email'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_EMAIL'), 'email');
} else if (!empty($values['email']) && (!preg_match(_JC_REGEXP_EMAIL2, $values['email']))) {
self::showErrorMessage(JText::_('ERROR_INCORRECT_EMAIL'), 'email');
} else if (($config->getInt('author_email')!= 0) && JCommentsSecurity::checkIsRegisteredEmail($values['email']) == 1) {
self::showErrorMessage(JText::_('ERROR_EMAIL_EXISTS'), 'email');
} else if (($config->getInt('author_homepage') == 2) && empty($values['homepage'])) {
self::showErrorMessage(JText::_('ERROR_EMPTY_HOMEPAGE'), 'homepage');
} else {
$noErrors = true;
}
if (!$noErrors) {
return $response;
}
}
далее заходим в /components/com_jcomments/tpl/default/tpl_form.php. (default это название шаблона. если есть другая папка, то скорее нужно выбрать другую например /tpl/vina/tpl_form.php)
и в районе строки 65 видим код
<form id="comments-form" name="comments-form" action="javascript:void(null);">
<?php
$this->getFormFields($htmlFormPrepend);
?>
<?php
if ($this->getVar( 'comments-form-user-name', 1) == 1) {
$text = ($this->getVar('comments-form-user-name-required', 1) == 0)? JText::_('FORM_NAME') : JText::_('FORM_NAME_REQUIRED');
?>
<p>
<span>
<input id="comments-form-name" type="text" name="name" value="" maxlength="<?php echo $this->getVar('comment-name-maxlength');?>" size="22" tabindex="1" />
<label for="comments-form-name"><?php echo $text; ?></label>
</span>
</p>
добавляем тестовое поле
<input type="text" placeholder="name2" name="name2" value="" id="comments-form-name2" />
чтобы было вот так
<form id="comments-form" name="comments-form" action="javascript:void(null);">
<?php
$this->getFormFields($htmlFormPrepend);
?>
<?php
if ($this->getVar( 'comments-form-user-name', 1) == 1) {
$text = ($this->getVar('comments-form-user-name-required', 1) == 0)? JText::_('FORM_NAME') : JText::_('FORM_NAME_REQUIRED');
?>
<p>
<span>
<input id="comments-form-name" type="text" name="name" value="" maxlength="<?php echo $this->getVar('comment-name-maxlength');?>" size="22" tabindex="1" />
<input type="text" placeholder="name2" name="name2" value="" id="comments-form-name2" />
<label for="comments-form-name"><?php echo $text; ?></label>
</span>
</p>
и в любой ваш CSS файл пишем
#comments-form-name2 {display:none;}
боты будут заполнять это поле и вы будете возвращать ошибку
человек это поле не заполнит и оно всегда будет пустым