Page 1 of 1
Using reCaptcha with Comments module [SOLVED]
Posted: Tue Sep 22, 2009 11:18 am
by jervi
Hi!
The Capthca module works great with the Comments module, except from when I select to use reCaptcha instead of the one of the other options. As reCaptcha uses it's own input field, the captcha is never validated. How can I modify the template (or the source code) to let reCaptcha do the validation?

SOLVED: Re: Using reCaptcha with Comments module
Posted: Thu Oct 01, 2009 4:38 pm
by carasmo
In the modules/comments
action.default.php line 107 find:
Code: Select all
if (TRUE == empty($params['captcha_phrase']) || ! $captcha->CheckCaptcha($params['captcha_phrase'])) {
change to:
Code: Select all
if (FALSE == empty($params['captcha_phrase']) || ! $captcha->CheckCaptcha($params['captcha_phrase'])) {
then in the comments template in the admin area:
Find this:
Code: Select all
{if $spamprotect}
<tr>
<td>{$entercodetxt}:</td>
<td>{$inputentercode}</td>
</tr>
{/if}
and remove the first table return with redundant code in it (it's ONLY redundant *if* the reCaptcha is used)
Because you're using reCaptcha, you'd remove the instructions to enter the code "entercodetxt" (in the lang file) and the input field "inputentercode"
Next, to style the reCaptcha you can do this:
Put this in the head of your template between the literal tags
Code: Select all
<__script__ type="text/javascript">
var RecaptchaOptions = {
theme : 'clean'
};
</__script>
Then add this to your css and change as you like.
Code: Select all
/* Recaptcha Styles */
.recaptchatable .recaptcha_image_cell, #recaptcha_table {
background-color:transparent !important; /* reCaptcha widget background color*/
}
#recaptcha_table {
border-color: #fff !important; /* reCaptcha widget border color*/
}
#recaptcha_response_field {
border-color: #333 !important; /* Text input field border color*/
background-color:#fff !important; /* Text input field background color*/
}
#recaptcha_table img {
border:0px!important; /* stop spam read books removing border from this image*/
}
Re: Using reCaptcha with Comments module [SOLVED]
Posted: Sun Nov 29, 2009 11:19 am
by mirdj
Thanx for this solution, works like a charm
