Using reCaptcha with Comments module [SOLVED]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jervi
New Member
New Member
Posts: 2
Joined: Fri Aug 21, 2009 6:59 am

Using reCaptcha with Comments module [SOLVED]

Post 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?
Image
Last edited by jervi on Fri Oct 09, 2009 3:04 pm, edited 1 time in total.
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm
Location: Florida

SOLVED: Re: Using reCaptcha with Comments module

Post 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*/ 
  
 }


mirdj
New Member
New Member
Posts: 5
Joined: Mon May 18, 2009 5:55 pm

Re: Using reCaptcha with Comments module [SOLVED]

Post by mirdj »

Thanx for this solution, works like a charm  ;D
Post Reply

Return to “Modules/Add-Ons”