Forums / All Other Contributions/Addons / Support Thread for Google reCAPTCHA plugin

Support Thread for Google reCAPTCHA plugin

Results 1 to 20 of 692
21 Jul 2012, 17:18
#1
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Support Thread for Google reCAPTCHA plugin

I've started this thread to provide support for my Google reCAPTCHA plugin. http://www.zen-cart.com/downloads.php?do=file&id=1455
Any questions or problems let me know below
Regards
David
23 Jul 2012, 13:53
#2
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Posts:
730
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

I found that the template folder requires an extra templates folder after the custom template path. It all works fine now after doing that :smile:

Many thanks for this module
23 Jul 2012, 15:35
#3
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

@HeathenMagic - you are correct, thanks for the feedback. I will submit an updated version to correct that.
Regards
David
31 Jul 2012, 01:13
#4
williewontgo avatar

williewontgo

New Zenner

Join Date:
Oct 2009
Posts:
70
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Thank you for this mod/plug-in!

Getting an HTTPS error on the create_account page (prompting the user if they want to view only content that is secure). Any idea how to remedy this issue?

Thank you.
31 Jul 2012, 09:15
#5
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

@willieWontGo
Thanks for trying the plugin. I hadn't tested it on HTTPS so hadn't encountered that problem.
The solution is simple - in the Contact-us template file change the line (step 4 in instalation, step 6 for create account)

<?php echo recaptcha_get_html($publickey, $resp->error); ?>


to this

<?php echo recaptcha_get_html($publickey, $resp->error, true); ?>


The extra 'true' tells it to use SSL and should solve the problem.

In the next version I'll get it to pick up the HTTPS automatically

Regards
David
31 Jul 2012, 17:26
#6
williewontgo avatar

williewontgo

New Zenner

Join Date:
Oct 2009
Posts:
70
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Thank you, David.

All fixed, all set.

I appreciate your contribution.
07 Aug 2012, 22:31
#7
mhawkins avatar

mhawkins

New Zenner

Join Date:
Jun 2009
Posts:
40
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Any suggestions for adding captchas to ask a questions mod. I have put the code in the header.php of pages/ask a question. And also added it to templates/ask a question.default. I changed the code to reflect ask a question 1 time in header.php and 4 instantances in template default. But it does not work. I can see a thin box below the message box but captcha does not show and cannot not send an email through to myself. I am not sure where to go from here. I am installing on 1.5. The contact us captcha works fine.
07 Aug 2012, 22:52
#8
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

mhawkins:

Any suggestions for adding captchas to ask a questions mod. I have put the code in the header.php of pages/ask a question. And also added it to templates/ask a question.default. I changed the code to reflect ask a question 1 time in header.php and 4 instantances in template default. But it does not work. I can see a thin box below the message box but captcha does not show and cannot not send an email through to myself. I am not sure where to go from here. I am installing on 1.5. The contact us captcha works fine.


I've not used the ask a question mod, but I've just d/loaded it and had a quick look.

I think that in the header.php you need to add in code in a similar way to the contact-us header.php (as per step 3 in the reCAPATCHA instructions, inserted at about line 42 in the ask a question header file)
So
        // add in reCaptcha check
        $resp = recaptcha_check_answer ($privatekey,
            $_SERVER["REMOTE_ADDR"],
            $_POST["recaptcha_challenge_field"],
            $_POST["recaptcha_response_field"]);
    
        if (!$resp->is_valid) {
            // set the error code so that we can display it
            $messageStack->add('contact', $resp->error);
            $error = true;
        }
    then change the line below from 
        if ($zc_validate_email and !empty($enquiry) and !empty($name)) {
    to
        if ($zc_validate_email and !empty($enquiry) and !empty($name) and $error == false) {

Then in the template file add in the
<?php echo recaptcha_get_html($publickey, $resp->error); ?>
line at about line 80 in tpl_ask_a_question_default
20 Aug 2012, 16:12
#9
ralberts avatar

ralberts

New Zenner

Join Date:
Jul 2012
Posts:
18
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi,
I'm using ZenCart 1.3.9h and have successfully installed your mod on the Contact Us page.
If I enter the incorrect Captcha code and press <enter>, then the validation fails (as it should).
However if I enter the incorrect Captcha code and click on <send> then the message is sent successfully.
Any ideas what the problem may be? :frusty:
Many thanks for your mod and your help!
Ronel
20 Aug 2012, 16:37
#10
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi Ronel
Did you manually add the code to /modules/pages/contact-us/header.php?
If so, I suspect you didn't change the line below from
 if ($zc_validate_email and !empty($enquiry) and !empty($name)) { 

to
if ($zc_validate_email and !empty($enquiry) and !empty($name) and $error == false) { 


Hope this helps. If not post the code from the file here and I'll see what I can see.

Regards
David
24 Aug 2012, 09:24
#11
porteast avatar

porteast

New Zenner

Join Date:
Nov 2008
Posts:
8
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi David
I'm using ZenCart 1.5 and have successfully installed your mod on the Contact Us page.
The captcha block appears below the contact us form correctly.
The problem is however: with or without the code being filled in, the message is being sent successfully
I've checked my installation a few times and everything seems fine. It is obvious that I am still missing something somewhere.
I am using the "aberdeen-natural" theme.
Could you please assist.
Thanks
JC
24 Aug 2012, 10:22
#12
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi JC - Sounds like a similar problem to Ronel's above. I can only think that either the $error flag isn't being set when the capatcha returns as not valid, or that $error isn't being checked properly before the mail is sent.
If you could paste the top few lines of code from the file - I'll see what I can see.
Regards
David
24 Aug 2012, 13:17
#13
porteast avatar

porteast

New Zenner

Join Date:
Nov 2008
Posts:
8
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

Hi JC - Sounds like a similar problem to Ronel's above. I can only think that either the $error flag isn't being set when the capatcha returns as not valid, or that $error isn't being checked properly before the mail is sent.
If you could paste the top few lines of code from the file - I'll see what I can see.
Regards
David


Hi Dave
Here are the first few lines up to and including your changes. (/includes/modules/pages/contact_us/header_php.php

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));

$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
  $name = zen_db_prepare_input($_POST['contactname']);
  $email_address = zen_db_prepare_input($_POST['email']);
  $enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));

  $zc_validate_email = zen_validate_email($email_address);
	// add in reCaptcha check
	$resp = recaptcha_check_answer ($privatekey,
		$_SERVER["REMOTE_ADDR"],
		$_POST["recaptcha_challenge_field"],
		$_POST["recaptcha_response_field"]);

	if (!$resp->is_valid) {
		// set the error code so that we can display it
		$messageStack->add('contact', $resp->error);
		$error = true;
	}

	if ($zc_validate_email and !empty($enquiry) and !empty($name) and $error == false) {


I did not change the original version, I replaced it with the one you supplied.

Thanks
JC
24 Aug 2012, 14:15
#14
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

JC - can't see anything wrong with that - as you say it's the downloaded one. Very odd.
I've quickly tried a few other things that I thought could possibly cause it (and some that I was sure wouldn't), but have come up blank. I can't get it to send without the reCAPATCHA filled in.
I'm stumped, sorry. All I can suggest is putting some debugging statements in the file to try and find out why $error isn't being set to true when the reCAPATCHA isn't filled in.
24 Aug 2012, 15:07
#15
porteast avatar

porteast

New Zenner

Join Date:
Nov 2008
Posts:
8
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Thanks for your prompt reply David. I will play around with it and post results here.

JC
25 Aug 2012, 16:07
#16
ralberts avatar

ralberts

New Zenner

Join Date:
Jul 2012
Posts:
18
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi David,

No I didn't change the code manually - just installed your plug-in as it was. I did however check the code against your manual changes, and everything's as it should be.
The plugin installed a file called header_php.php, not header.php - maybe this is a problem?

Ronel
25 Aug 2012, 16:41
#17
ralberts avatar

ralberts

New Zenner

Join Date:
Jul 2012
Posts:
18
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

ralberts:

Hi David,

No I didn't change the code manually - just installed your plug-in as it was. I did however check the code against your manual changes, and everything's as it should be.
The plugin installed a file called header_php.php, not header.php - maybe this is a problem?

Ronel



Ok, that was one of my more moronic questions. :blush:

The captcha works fine on the Create Account page though.
26 Aug 2012, 10:50
#18
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

ralberts:

Ok, that was one of my more moronic questions. :blush:

The captcha works fine on the Create Account page though.

:smile:

If it works fine on the Create Account page that removes several (unlikely) causes of the problem on the contact-us page. You could try putting some debugging statements in header_php.php (sorry about typo earlier that caused your confussion) eg print_r($resp) and see what is happening. Or you could try changing the line
if (!$resp->is_valid) { 

to
if ($resp->is_valid !== true) { 

in case there is some weird type conversion going on.
12 Sep 2012, 13:14
#19
dochsa avatar

dochsa

New Zenner

Join Date:
Apr 2008
Posts:
62
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi David

I have just installed the mod. Thanks. But I have to say that I am having the same issues are some of the other users. The page goes through no matter if the code is correct or not. Has there been a fix or do you have some advise about this?

This si my site: www.assceneon.com

Also it does not seem to be rendered correctly. The picture is skew.

Donovan
12 Sep 2012, 14:25
#20
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Posts:
141
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

dochsa:

Hi David

I have just installed the mod. Thanks. But I have to say that I am having the same issues are some of the other users. The page goes through no matter if the code is correct or not. Has there been a fix or do you have some advise about this?

This si my site: www.assceneon.com

Also it does not seem to be rendered correctly. The picture is skew.

Donovan


Hi Donovan
I've just tried it on your site and it appeared to work correctly :smile:. Can you check that you got just one email (EDIT two emails as I tried it using Firefox and IE) from me.
Regards
David