Ok, I updated my instructions as followed now (should work with JComments 2.2.0.2):
Modifiy jcomments.ajax.php (components/com_jcomments/jcomments.ajax.php):
Replace (lines 254 - 285):
if ($acl->check('enable_captcha') == 1) {
$captchaEngine = $config->get('captcha_engine', 'kcaptcha');
if ($captchaEngine == 'kcaptcha') {
with:
$captchaEngine = $config->get('captcha_engine', 'recaptcha');
if ($captchaEngine == 'recaptcha') {
require_once(JCOMMENTS_BASE.DS.'libraries/recaptcha/'.'recaptchalib.php');
$privatekey = "<place your own private key here>";
$resp = null;
$error = null;
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$error = $resp->error;
JCommentsAJAX::showErrorMessage($response, 'captcha', JText::_('ERROR_CAPTCHA'), true);
# if (JCommentsCaptcha::attempts() > 3) {
# JCommentsCaptcha::destroy();
# $response->addScript("jcomments.clear('captcha');");
# }
return $response;
}
} elseif ($captchaEngine == 'kcaptcha') {
Modifiy tpl_form.php (components/com_jcomments/tpl/default/tpl_form.php):
Replace (lines 100 - 113):
if ($this->getVar('comments-form-captcha', 0) == 1) {
$html = $this->getVar('comments-form-captcha-html');
if ($html != '') {
echo $html;
} else {
$link = JCommentsFactory::getLink('captcha');
?>
<p>
<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" name="captcha-image" src="<?php echo $link; ?>" width="121" height="60" alt="<?php echo JText::_('FORM_CAPTCHA'); ?>" /><br />
<span class="captcha" onclick="jcomments.clear('captcha');"><?php echo JText::_('FORM_CAPTCHA_REFRESH'); ?></span><br />
<input class="captcha" id="comments-form-captcha" type="text" name="captcha-refid" value="" size="5" tabindex="6" /><br />
</p>
<?php
}
with:
if ($this->getVar('comments-form-captcha', 0) == 1) {
$captcha = 'recaptcha';
if ($captcha == 'recaptcha') {
$publickey = "<place your own pubilc key here>";
$theme = "white";
$lang = "de";
require_once(JCOMMENTS_BASE.DS.'libraries/recaptcha/'.'recaptchalib.php');
$js = "var RecaptchaOptions = {"."\n";
$js .= "theme : '".$theme."',"."\n";
$js .= "lang : '".$lang."'"."\n";
$js .= "};";
$recaptchaOptions =& JFactory::getDocument();
$recaptchaOptions->addScriptDeclaration($js);
?>
<span id="comments-form-captcha" name="captcha-refid"><?php echo recaptcha_get_html($publickey, $error); ?></span>
<?php
} elseif ($captcha == 'kcaptcha') {
$html = $this->getVar('comments-form-captcha-html');
if ($html != '') {
echo $html;
} else {
$link = JCommentsFactory::getLink('captcha');
?>
<p>
<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" name="captcha-image" src="<?php echo $link; ?>" width="120" height="60" alt="<?php echo JText::_('FORM_CAPTCHA'); ?>" /><br />
<span class="captcha" onclick="jcomments.clear('captcha');"><?php echo JText::_('FORM_CAPTCHA_REFRESH'); ?></span><br />
<input class="captcha" id="comments-form-captcha" type="text" name="captcha-refid" value="" size="5" tabindex="6" /><br />
</p>
<?php
}
}
}
The rest should be the same like I mentioned before.