Zen Cart Logo
Forums / All Other Contributions/Addons / Google reCaptcha

Google reCaptcha

Views: 1,346

Results 1 to 5 of 5
28 Apr 2020, 10:51 PM
#1
rensing avatar

rensing

New Zenner

Join Date:
Oct 2012
Location:
St. Catharines, ON Canada
Posts:
91
Plugin Contributions:
0

Google reCaptcha

I’ve switched from OpenCart to Zen-Carr 1.5.6c and quickly found out I needed to install a captcha to stop the berrage of spam I started to get.
I have installed Google reCaptcha but I’m having trouble finding out where line from step 3 goes.
At present if you go to https://afghansniagara.ca and try to create an account it puts a warning that says to make sure you’re not a robot but doesn’t show the checkbox.
I sent a message to the person that made the module but I would like to get this working ASAP.
If anyone can help me with this please tell me the name/location of the file to edit and at which place to put that little bit of code.

Thanks

28 Apr 2020, 11:03 PM
#2
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Google reCaptcha

Here's another potential option for you to use if you don't get any satisfaction from the one you are currently attempting.
Zen NonCAPTCHA CAPTCHA

https://www.zen-cart.com/downloads.php?do=file&id=2207

29 Apr 2020, 1:05 AM
#3
rensing avatar

rensing

New Zenner

Join Date:
Oct 2012
Location:
St. Catharines, ON Canada
Posts:
91
Plugin Contributions:
0

Re: Google reCaptcha

Thank you. I’ll keep that in mind.

29 Apr 2020, 6:27 AM
#4
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,844
Plugin Contributions:
0

Re: Google reCaptcha

If you only want it on the contact us page you can follow this procedure

Copy /includes/templates/template_default/templates/tpl_contact_us_default.php to /includes/templates/responsive_classic/templates/
Then edit that file and find this code

<?php echo zen_draw_input_field('should_be_empty', '', ' size="40" id="CUAS" style="visibility:hidden; display:none;" autocomplete="off"'); ?>

insert the <?php echo recaptcha_get_html(); ?> after that line

then go to /includes/classes/observers/class.google_recaptcha.php an edit the following section

	//comment out any pages you do NOT want to check
		$pages_to_check[] =  'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
		$this->attach($this,$pages_to_check);
	}

So that it looks like this

	//comment out any pages you do NOT want to check
		$pages_to_check[] =  'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
		//$pages_to_check[] =  'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
		//$pages_to_check[] =  'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
		$this->attach($this,$pages_to_check);
	}
29 Apr 2020, 3:59 PM
#5
rensing avatar

rensing

New Zenner

Join Date:
Oct 2012
Location:
St. Catharines, ON Canada
Posts:
91
Plugin Contributions:
0

Re: Google reCaptcha

Thank for the info barco57.

I followed your directions but at first I still got the red warning to make sure I'm not a robot.

Then I noticed that the line: //$pages_to_check[] = 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK'; had been commented out so I removed the // and it appears to be working.
I created an account for myself but did not have to check anything to show I wasn't a robot. Is this how the Google reCaptcha is supposed to work?