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

Support Thread for Google reCAPTCHA plugin

Views: 176,327

Results 221 to 240 of 694
30 Oct 2015, 6:03 PM
#221
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

Support Thread for Google reCAPTCHA plugin

cj.dekrijger:

Hello,

I don't know if I am at the right place here but i haven's seen a "start thread" option. Here's
my problem.
reCAPTCHA is n't working all the time i haven't seen it on the new account page and not
always on the contact us page. i checked the files they are all there in the right place, checked
google key's they are also in the right file?
So what can be wrong in my situation ? (check itparts.biz/zentest)

It seemed to show up fine on both the account and contact page for me. I used chrome, cleared cache and jumped around. It showed every time.

22 Dec 2015, 4:10 PM
#222
tmorty22 avatar

tmorty22

New Zenner

Join Date:
Dec 2015
Location:
AZ
Posts:
2
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

Hi Anne
I'm assuming you are using the 'Ask a Question' plugin - https://www.zen-cart.com/downloads.php?do=file&id=109
If so, it should be fairly easy to add it to that.
Essentially you need too look at the instruction for pre-1.5.1 installation

In /includes/modules/ask_a_question/header.php just after line 41 add:

$zco_notifier->notify('NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK');

> and change the line below it 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) {

> 
> in /includes/classes/observers/class.google_recaptcha.php insert this just below line number 23 
> ```
$pages_to_check[] =  'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK';

in your tpl_ask_a_question_default.php file (probably just under the textarea, so line 80) add

<?php echo recaptcha_get_html(); ?>
> 
> That should do it :)


I added the recaptcha to the Ask A Question as described.  My only issue is that no error message is shown if they forget to mark the checkbox.  How do I make the error message appear like it does on the Contact Us form?
22 Dec 2015, 8:30 PM
#223
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Any idea how to implement this on the Testimonials Page? I have it setup on all our other pages like Contact Us, Reviews, Create Account Etc. but been getting spam testimonials.

Thank you

23 Dec 2015, 1:41 PM
#224
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Hi
Sorry, looks like I missed one extra change to make
In /includes/classes/observers/class.google_recaptcha.php change line number 42
from ```
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');

to ```
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'contact');

Then hopefully it should work

23 Dec 2015, 1:47 PM
#225
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Hi - I'm not familiar with the testimonials page, did you create it via a plugin?

Regards

23 Dec 2015, 3:43 PM
#226
tmorty22 avatar

tmorty22

New Zenner

Join Date:
Dec 2015
Location:
AZ
Posts:
2
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

Hi
Sorry, looks like I missed one extra change to make
In /includes/classes/observers/class.google_recaptcha.php change line number 42
from ```
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');

> to ```
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'contact');

Then hopefully it should work

In an earlier post you had the code below, which I had originally used:

David Allen:

Hi Anne
Opps forgot - in /includes/classes/observers/class.google_recaptcha.php line 42 change

$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');

> to
> ```
$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'ask_a_question');

So now I replaced the line below:
'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'ask_a_question')

With:
'review_text','NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK' => 'contact')

And it worked perfectly.

Thank you!

23 Dec 2015, 3:53 PM
#227
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Excellent - glad that worked
Regards

23 Dec 2015, 4:22 PM
#228
coins2012 avatar

coins2012

New Zenner

Join Date:
Jan 2012
Posts:
89
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

Hi - I'm not familiar with the testimonials page, did you create it via a plugin?

Regards

Yes, it's a plugin called Testimonial Manager.

4 Feb 2016, 4:23 AM
#229
gsallen101289 avatar

gsallen101289

New Zenner

Join Date:
Aug 2009
Posts:
44
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

First, Thank you for this mod! I am trying to add to my store http://kidswithagrin.com
It works on create an account but not on contact_us. I tried to manually modify the header_php.php file with no luck. Here is my original file. Do you see anything wrong? Thank you!

<?php /** * Contact Us Page * * @package page * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: header_php.php 6202 2007-04-12 22:56:10Z drbyte $ * Adapted by Joe McFrederick for reCAPTCHA text */ require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); // reCAPTCHA mod BOF require(DIR_WS_CLASSES . 'recaptchalib.php'); // reCAPTCHA mod EOF $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); // reCAPTCHA mod BOF 1 of 2 if(CONTACT_US_RECAPTCHA_STATUS == 'true') { // start modification for reCaptcha // the response from reCAPTCHA $resp = null; // was there a reCAPTCHA response? $resp = recaptcha_check_answer (CONTACT_US_RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], zen_db_prepare_input($_POST["recaptcha_challenge_field"]), zen_db_prepare_input($_POST["recaptcha_response_field"]) ); } // reCAPTCHA mod BOF 1 of 2 if ($zc_validate_email and !empty($enquiry) and !empty($name)) // auto complete when logged in if($_SESSION['customer_id']) {
4 Feb 2016, 4:32 AM
#230
gsallen101289 avatar

gsallen101289

New Zenner

Join Date:
Aug 2009
Posts:
44
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

I changed the header_php.php to the following with no luck:

  • @copyright Portions Copyright 2003 osCommerce

  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

  • @version $Id: header_php.php 6202 2007-04-12 22:56:10Z drbyte $

  • Adapted by Joe McFrederick for reCAPTCHA text

*/

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) {
5 Feb 2016, 11:30 AM
#231
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Hi

This version looks like it should work - I suspect there is an error occurring somewhere in the recaptcha_check_answer function, which means that $resp is blank or null.

26 Apr 2016, 2:32 AM
#232
searchn avatar

searchn

New Zenner

Join Date:
May 2014
Posts:
6
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

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

Hello David, We are using zen cart 1.5.5 and I installed your plugin, it works great for the contact us page, however on the new account client registration page, it keeps displaying the error at the top "Please verify that your are not a robot", but the validate has a green check mark. Any ideas on how to fix?

https://www.skincareproducts4all.com

Thank you very much!

26 Apr 2016, 2:39 AM
#233
searchn avatar

searchn

New Zenner

Join Date:
May 2014
Posts:
6
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Okay, please forgive me, how do we resolve the $resp is null

27 Apr 2016, 8:09 PM
#234
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Hi Searchn

I haven't had chance to test it yet with v1.5.5, but I can't see any changes that would cause it not to work. I just tried the create account on your site and it does come up with the error.
I think somehow the reCaptcha response isn't being sent back to the form processing script. Not sure why, the only thing I can see is an extraneous </fieldset> in the html immediately after the reCaptcha. Try getting rid of that and see if it helps

Regards

27 Apr 2016, 9:07 PM
#235
searchn avatar

searchn

New Zenner

Join Date:
May 2014
Posts:
6
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

Hi Searchn

I haven't had chance to test it yet with v1.5.5, but I can't see any changes that would cause it not to work. I just tried the create account on your site and it does come up with the error.
I think somehow the reCaptcha response isn't being sent back to the form processing script. Not sure why, the only thing I can see is an extraneous </fieldset> in the html immediately after the reCaptcha. Try getting rid of that and see if it helps

Regards

Thanks for the reply. I tried that and it crashes the page. I moved the recapcha line around and still no luck. See the tail end of the tpl_modules_create_account.php file.

<?php echo recaptcha_get_html(); ?> <?php if (CUSTOMERS_REFERRAL_STATUS == 2) { ?> <fieldset> <legend><?php echo TABLE_HEADING_REFERRAL_DETAILS; ?></legend> </fieldset> <div class="form-group"> <label class="inputLabel" for="customers_referral"><?php echo ENTRY_CUSTOMERS_REFERRAL; ?></label> <?php echo zen_draw_input_field('customers_referral', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '15') . ' id="customers_referral" class="form-control"'); ?> </div>
<?php } ?>
</div>
27 Apr 2016, 9:50 PM
#236
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Looks like you moved a lot of the </fieldset>s around, mostly to move them up to just after the </legend> - not sure why you did that as it means the <fieldset> doesn't contain any fields, which defeats its purpose).
Also looks like the recaptch is inside <div class="newsletter_block"> - again not sure if you meant it to be.

I'm amazed that removing an extra </fieldset> would cause the page to crash - malformed html rarely crashes pages, it's usually bad php that does that.

Regards
David

27 Apr 2016, 10:00 PM
#237
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

You could also try replacing your tpl_modules_create_account_default.php with the on from the default template and adding the recaptcha line into that. It will mess up your design, but you'll be able to quickly test if it solves the problem.

27 Apr 2016, 10:37 PM
#238
searchn avatar

searchn

New Zenner

Join Date:
May 2014
Posts:
6
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

David Allen:

You could also try replacing your tpl_modules_create_account_default.php with the on from the default template and adding the recaptcha line into that. It will mess up your design, but you'll be able to quickly test if it solves the problem.

Hi David, I did not do anything but move the <?php echo recaptcha_get_html(); ?> around. The rest of the code is from the theme we installed. Forgive me I am not an PHP expert. Not sure what you mean with the fieldset . Can you look at the original file? attached

27 Apr 2016, 10:57 PM
#239
david_allen avatar

david_allen

Zen Follower

Join Date:
Feb 2008
Location:
Amersham, Buckinghamshire, United Kingdom
Posts:
141
Plugin Contributions:
1

Re: Support Thread for Google reCAPTCHA plugin

Try removing line 187 from the file you attached - the line that just says </fieldset> -
The position you placed the ```

<?php echo recaptcha_get_html(); ?>
Regards
27 Apr 2016, 11:10 PM
#240
searchn avatar

searchn

New Zenner

Join Date:
May 2014
Posts:
6
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

If I remove line 187, wont that break the beginning statement on 185?
185 <fieldset>
186 <legend><?php echo ENTRY_EMAIL_PREFERENCE; ?></legend>
187 </fieldset>