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
Printable View
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
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
@HeathenMagic - you are correct, thanks for the feedback. I will submit an updated version to correct that.
Regards
David
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.
@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)
to thisCode:<?php echo recaptcha_get_html($publickey, $resp->error); ?>
The extra 'true' tells it to use SSL and should solve the problem.Code:<?php echo recaptcha_get_html($publickey, $resp->error, true); ?>
In the next version I'll get it to pick up the HTTPS automatically
Regards
David
Thank you, David.
All fixed, all set.
I appreciate your contribution.
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
Then in the template file add in theCode:// 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) {
line at about line 80 in tpl_ask_a_question_defaultCode:<?php echo recaptcha_get_html($publickey, $resp->error); ?>
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
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
toCode:if ($zc_validate_email and !empty($enquiry) and !empty($name)) {
Hope this helps. If not post the code from the file here and I'll see what I can see.Code:if ($zc_validate_email and !empty($enquiry) and !empty($name) and $error == false) {
Regards
David
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
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
I did not change the original version, I replaced it with the one you supplied.Code: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) {
Thanks
JC
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.
Thanks for your prompt reply David. I will play around with it and post results here.
JC
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
: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 linetoCode:if (!$resp->is_valid) {
in case there is some weird type conversion going on.Code:if ($resp->is_valid !== true) {
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 David
Thanks it works fine now. I thing it had to do with latency of my ISP. One other thing. How do I get it to work on my SSL pages? Currently a warning flashes up, when you go to the contact us or create an account page that not all items are secure? Is there something I should have done with Google?
Thanks in advance.
Dono
Hi!
I`d like to include this mod to an EZ-page on which customers can send me their suggestions.I get spam messages so I MUST include some captcha script to this page.Any ideas how could this be done?
It shouldn't be too hard :) - you just need to add the lineinto the suggestion form - this shows the CAPTCHA to your customers. Then in the code which sends the email, add in the check for a correct responseCode:<?php echo recaptcha_get_html($publickey, $resp->error); ?>
Hope this helpsCode:$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('your-EZ-page', $resp->error);
$error = true;
}
Regards
David
It showes error); ?> on the suggestions page and then shows the form, but no captcha is loaded
looks like your php tags are out of synch.
You will also need the recaptchalib.php file in the extra functions folder.
it is there
David,
For v1.5.1 and newer (since some captcha-related notifier hooks were added to v1.5.1), you can drop the changes your v1.1 plugin makes to the /includes/modules/ files and simply add the attached notifier support files to accomplish the same results.
Makes integration a lot simpler that way because there's fewer files to edit (esp since some of those files are often edited by other plugins), and simpler to update in the future too.
I might also suggest that using zen_get_ip_address() instead of $_SERVER['REMOTE_ADDR'] might provide more accurate results especially if the visitor is behind some sort of proxy or forwarder, or the store's hosting company is using some sort of proxying or caching engine that incorrectly passes the store's IP instead of the visitor's IP.
Thanks for that. I've just d/loaded today's new 1.51 and see the added notifier hooks. Brilliant. It will, as you say, make things a lot simpler.
In order not to have to maintain 2 versions (pre-1.51 and 1.51+) going forward, I'm thinking that I should make the pre-1.51 version also use the observer class. A quick question if I may. Am I correct in that all I would need (apart from the check on $error) to add to those header_php.php files would be the lineI like the sugestion of using zen_get_ip_address(). I'll add that to the observer class.Code:$zco_notifier->notify('NOTIFY_CONTACT_US_CAPTCHA_CHECK');
Many thanks
David
The only requirements you'd need to backport would be the changes that added the notifier points to those modules files.
Thanks DrByte - new version being tested, docs still to do :)
Regards
David
New version released.
v2.0 uses the new notifier hooks added in ZenCart v1.5.1 and a new observer class. So no core files to alter if you're using v1.5.1 or newer :)
I expanded it to include the write a review page as well as adding the auto detection of SSL pages. It now uses zen_get_ip_address() to better cope with proxies etc.
We are currently having our Zencart version being updated from 1.3.9 to 1.5 ,we have the Captcha succesfully integrated to our older version 1.3.9 of Zencart however our developer having a difficulty to install this to the new 1.5 version because of the GD and Imagemagick are not installed ,also she said we are having a PHP depraceted code issue and our hosting Godaddy not support this
Can you please suggest the way forward how this can be solved?
Hello David. This is very kind of you for sharing this contribution of yours. I have a simple question, I am using zencart v1.3.8a and would like to know if there is any possibility to put the reCaptcha in the admin login page. I think that would help in protecting against robotic brute-force attempts. I can not move to ZC 1.5 for now, as I have done many core edits.
Thank you in advance.
[QUOTE=zilog357;1157983]I am using zencart v1.3.8a and would like to know if there is any possibility to put the reCaptcha in the admin login page.
</QUOTE]
Zilog - it should be possible to include it on the admin login page. You'd have to include the files in the corresponding admin folders and add the appropriate entries to login.php.
I'm interested as to why you are getting brute force attempts? You did rename your admin directory didn't you??
I think that as you are using such an old version the possibility of robotic brute-force attempts is much less than the gaping security holes that are known to exist in those older versions on Zen.
I'd recommend upgrading asap
In response to a post in another thread I thought I'd highlight some of the customisations that cane be made to the appearance of the Google reCAPTCHA.
Firstly there are 4 different styles supplied by Google:
https://developers.google.com/recapt...mple_White.pngWhite
https://developers.google.com/recapt...Sample_Red.pngRed (Default colour)
https://developers.google.com/recapt...mple_Black.pngBlack
https://developers.google.com/recapt...mple_Clean.png Clean
To use these just include the following script on the page
Additionally it is possible to style the individual elements through CSS. The following changes the font of the 'Type the two words' textCode:<script type="text/javascript">
var RecaptchaOptions = {
theme: 'white'
};
</script>
http://www.zen-cart.com/image/png;ba...AASUVORK5CYII=Code:.recaptcha_only_if_image {
color:red !important;
font-size:1.4em !important;
}
There are many more customisations available see this Google page for more information, or just post here and I'll be happy to help.
Regards
David
Oops - I forgot to paste in the image of the css customised version:
Edit second attempt - pasting the image didn't work. I'll upload it this time :)
Attachment 11380
hi, i have the latest version of this mod installed on 1.5, works well, thanks.
However, first of all i didn't upload tpl_modules_create_account.php because i thought that this might mean then that there would not be a captcha on the account create page, i dont want a captcha there. However, when i tried to create an account, even though there was no captcha there, when i submitted it said incorrect captcha and couldn't create an account, and thus couldn't checkout. So, i just uploaded the file and it worked fine, but there is a captcha there. My first question is how can i sort so dont have a captcha on the account create page, if possible?
When an incorrect captcha is entered how do i change the alert message text? It is currently something like 'incorrect captcha sol' or such like.
Module and help appreciated, thanks.
Matt
In the file /includes/classes/observers/class.google_recaptcha.php on line 14
change this:
toCode:$this->attach($this, array('NOTIFY_CONTACT_US_CAPTCHA_CHECK', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK'));
ie delete the 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK', bit. This stops it 'listening' for the create account hook.Code:$this->attach($this, array('NOTIFY_CONTACT_US_CAPTCHA_CHECK','NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK'));
That text is supplied by google - if you wanted to replace it with your own then on line 28 of that same file there is:
replace $resp_error with your own error message. If you want it multi-language you would have to add an entry likeCode:$messageStack->add($event_array[$eventID], $resp->error);
to includes/languages/english/Your_Template/contact_us.php and then instead of line 28 in the class file useCode:define('ENTRY_CAPTCHA_CHECK_ERROR','Incorrect Captcha entered - please try again.');
Glad you are finding it useful.Code:$messageStack->add($event_array[$eventID], ENTRY_CAPTCHA_CHECK_ERROR);
Regards
David
Thank you for your contribution. I have zc 1.3.9h and installed this mod according to instructions. Everything works fine. My only trouble is I can not find where to put the customization code for google recaptcha.
The instructions in the read me file are
" these can be specified by including the following code in the html before the code added in steps 5 and 6 (anywhere will do, at the begining on line 15 works for both files)" but there step 5 is about uploading files and step 6 does not exist.
Thanks
Nick
Hi Nick
The custom code should go in the includes/templates/Your_Template/templates/tpl_contact_us_default.php (and the create account, write review templates). The instruction should refer to step 3 (that bit of the readme was written for the previous version and I forgot to update it - sorry).
I'll update the instructions.
Regards
David
That was super fast answer! thank you.
Nick
Hi, thank you for the contrib.
I managed to get the contact us to work; but not the create account, even when the entry is wrong, the registration still goes through.
I have checked the tpl_modules_create_account.php file, the only thing is different from the reCaptcha copy is the referral mod.
Here: http://www.simpleartsplanet.com/create-account
I managed to get it to work. It's this instruction:
4c: In /includes/modules/YOUR_TEMPLATE/create_account.php, at around line 248 you should see the line:
if ($error == true) {
immediately before that add in the following code:
$zco_notifier->notify('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK');
Although running on zc1.5.1 engine, my cart was upgraded from 1.39h. Added that code, and everything is working! :laugh:
I use Zen Cart 1.3.8.
I installed Google reCaptcha and I followed the instructions.
I used your form(from "pre-v1.5.1).Code:create_account.php
I read:
and afterCode:$ zco_notifier-> notify ('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK');
This also happens through Contact Us formCode:if ($ error == true) {
What's wrong?
Regards
Mister D
Do you have a link to the site? It might help diagnose the problem.
I'm not sure but I think it may have something to do with the mega menu. Looking at the source of the contact us page I see the mega menu creates a form name="contact_us" which is the same name as the real (visible) contact us form on the page. I suspect it is somehow interfering in things.
Is it possible to turn that off briefly and then test to see if the problem persists?
Regards
David
Ah..I missed the 1.38 bit. I have to confess that I only tested the latest version with 1.39 and above. The original version worked with 1.38 (I think I remember testing it), if you wanted to give that a go. However upgrading to the latest version of Zen would be better, not least because of the security improvements since 1.38 was released.
I must be missing something, because for the life of me I dont see "Install Now" anywhere in the Admin pages at this step in the installation instructions?
Where do I find this link? I am quite new to ZenCart, but have spent the last two days working on it full time, and I havent seen any other plugin have this step.Quote:
6. Click link in at top of page labeled [Install Now]. recaptcha configuration will itself & sql statemtents.
http://shop.theblake.net ver 1.5.1
@theblake - I think you are trying to install the contact reCAPTCHA by pickupman - which doesn't appear to have it's own support thread. This thread is the support for my Google reCAPATCHA give it a go if you can't get anywhere with the other one.
I do notice that you are using 1.5.1 and the cantact reCAPTCHA was updated for 1.5.0 - maybe that might explain why you are having problems? Although I don't think too much changed between the two versions.
Sorry I can't be more help.
Regards
Thats Dave, thats right! I blame google, I searched and found this thread :-)
will give this one a go then.
Having trouble with the captcha add-on website: www.torontoturbo.com
I tried adding this to the "contact us" header drop down as we started getting heaving spamming last night. I added the code near line #19 as instructed but not working. I also noticed in the sidebox that the "contact us" link does not have a submit button now.....I cannot confirm if it was there before I tried to add the captcha or not.
Can anyome point me in the right direction?....amaybe with some step by step guidance.
Thank
Toronto Turbo
I am unable to edit the above thread.......
I have the side box "contact us" working now........There is not any captcha for the "contact us" on the top header?
Any info to put it there?
Thanks
Toronto Turbo.com
Glad you got it working from the contact-us page (the side box contact you refer to). As for the contact us form in the navigation menu, I had a look at the html and as far as I can see it should be as simple as addingto the code that produces the menu - it looks like you are using mega-menu.Code:<?php echo recaptcha_get_html($publickey, $resp->error, $request_type == 'SSL'); ?>
Hope this helps
Hi David,
Thank You for your great contribution, it works fine for me and my ZenCart v1.5.1 site.
My problem is that I can't make it work just for "Contact Us" page. I made the changes above, but still no luck.:wacko:
Thank You in advance!
Zi
Hi Zi - did you remove the line in /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_create_account.php
That should stop it being displayedCode:<fieldset>
<?php echo recaptcha_get_html($publickey, $resp->error,$request_type == 'SSL'); ?>
</fieldset>
Nice looking site btw
Regards
Hi Dave,
I just did it, and was going to write it here :p . Thank You anyway :thumbsup:
I'm glad you liked the site, thanks again and best regards :cheers:
I just installed the add-on. It works however when I enter text in a review and I submit before entering the reCAPTCHA code the text is removed. Customers could have several characters of text and they do not want to lose their text by just accidently submitting before entering the reCAPTCHA code. Does anyone have a solution?
Hi Jodean - Interesting, it does seem to be the way Zen cart works by default. (Same if they didn't give a rating). I haven't tried this yet, but you could try altering the file /includes/templates/YOUR_TEMPLATE/templates/tpl_product_reviews_write_default.php
around line 66 you should see
change this toCode:<?php echo zen_draw_textarea_field('review_text', 60, 5, '', 'id="review-text"'); ?>
Hope that works for youCode:<?php echo zen_draw_textarea_field('review_text', 60, 5, $review_text, 'id="review-text"'); ?>
Regards
Hi David,
Thank you for your so big job of the Google reCAPTCHA, but I have problem about how to change the place for the frame and the distance from the other frames.
For example, www.isense.co.nz, on the "Contact Us" page.
The Google reCAPTCHA frame is too close to above frame. I want to change it lower and more to the right side.
Shall I amend the CSS for it or is there any other place I can do it? Thank you very much!
Michael
Hi David,
Thanks very much for your prompt answer. Yes I have the same idea with you.
The Google reCAPTCHA is great absolutely. Thanks again. Cheers!
Michael
I received a private message asking for help, so rather than replying to that I thought I'd post the question here so other can benefit as well
I think the questioner is using v1.39h.Quote:
Hi David,
I was wondering if you could help me. I have installed your Google ReCaptcha mod and changed the look to 'Clean' and stuck it in a Div to centre it and it all works very well, what I am trying to do though is add this same code to 'Ask a Question' mod by Scott Wilson www.thatsoftwareguy.com
I can get it to look look exactly the same as on the other pages, however whether I enter the ReCaptcha code or not the form gets submitted. I don't get the message telling me I haven't filled this part of the form in. Any help you could give would be greatly appreciated.
Thank you for a great mod.
If you look at the ReadMe instructions for pre 1.51 versions. In section 4A are the changes for /includes/modules/pages/contact_us/header_php.php
You need to apply those same changes to /includes/modules/pages/ask_a_question/header_php.php (the line numbers will be different, look around line 41)
Hope this helps
Regards
Hi Robert
I had a look on the plugins and only found Ask a Question for the 1.39 version. So assumed you were using that - sorry.
Anyway, as the Ask a Question appears to be based on 1.39 code, the advice I gave above still stands. Use the 4A instructions on the ask a question header_php.php
Regards
David
Hi David,
Sorry to bother you again.
I used the "Clean" template from Google and added below codes to file "create_account.php". I just put below codes on the top of the file(Before <?php)
<script type="text/javascript">
var RecaptchaOptions = {
theme: 'clean'
};
</script>
But when login or register, I got one blank web page. After refresh I could see content again but it is still at the login or register page. (Actually login or registed successfully becasue the "Logout" is shown on the top").
If I delete the codes above, everything is ok.
Do you konw what is the reason? Thanks very much!
Michael
Hello :)
What am I doing wrong when I've installed the plugin, it seems to be working, but if I go to contact us and fill out the form and don't fill out the captcha it still sends the form?
-Kjetil Hansen
Only recently discovered a few things and made some changes to the code that was provided for Google ReCaptcha Version 1.1. Running ZenCart 1.5, with multiple add-ins installed. This or a similar add-in was identified early on as being necessary as a result of spam we began receiving last year. This has reduced that significantly.
So couple of issues, one that I didn't see anyone discuss/question, the other that I saw related to an offered solution.
1. The first is related to SSL: Unfortunately our organization has not acquired a SSL address that is the exact same as our NONSSL address, ie we used a shared certificate. Fortunately though the SSL address does not require any appended folder or login name to access the site, so while we may have Server.extension, our shared address is ServerExtension.Host.Extension2.
So it appears that when customers would try to create an account without previously having one created via an online purchase, our google captcha wouldn't work because we had obtained a private key from google that was not global and we had not obtained two unique keys to handle SSL and NONSSL. So... For those that have a shared certificate, we are able to NOT have a global google key, but still use recaptcha on both secure and non-secure webpages. Surrounding the following code in /storefolder/includes/functions/extra_functions/recaptchalib.php modified the below code:
Code:$publickey = "YOUR_PUBLIC_KEY";
$privatekey = "YOUR_PRIVATE_KEY";
Both of those sets of keys are to be obtained from google as described in the file.Code:if ($request_type == 'SSL') {
$publickey = "YOUR_SHAREDHOST_PUBLIC_KEY";
$privatekey = "YOUR_SHAREDHOST_PRIVATE_KEY";
} elseif ($request_type == 'NONSSL') {
$publickey = "YOUR_HOSTED_PUBLIC_KEY";
$privatekey = "YOUR_HOSTED_PRIVATE_KEY";
}
Probably could/should use a check against values in the configuration.php file to further simplify the above code; however, I hadn't thought about the benefit yet... Probably could have variables to enter all of the keys, informing the user to only enter the keys that they believe necessary and not to worry about the keys they do not need to modify, then later in the code, compare the server setup to identify if the additional keys would need to be used setting the individual keys "YOUR_SHAREDHOST_PUBLIC_KEY", etc... as required to continue moving forward. Otherwise, a hosted service that has a certificate for both the http: and https: version of the web address would have to enter the set of keys twice in the above code, or remove the additional code that performs the tests. For upgrade purposes I would think that updating a potential two lines of code to handle 2 situations would be better than updating 4 lines of code to handle the same 2 situations. At any rate...
Using the above code change, we are able to maintain the trusted security that our keys will only be used on our server/host, and not able to be passed around to be used anywhere for any reason, etc... (Security aspect.)
2. The other fix that I recommend, assuming that I follow the logic of other code in ZenCart, is that when calling recaptcha_get_html, instead of hard coding true into the command, to use what seems to be the more programmer friendly $request_type variable for comparison. It seems to me that ZenCart will assign $request_type = 'SSL' for pages loaded https:, and $request_type = 'NONSSL' for other pages. I tried to look around other areas that included reference to $request_type and it did seem like there were some checks with another variable to see if the other variable indicated more of a NONSSL condition; however, it seemed that those tests were more for addressing the admin panel than for the rest of the store and/or I didn't understand the need for the additional comparisons. So wherever the recaptcha_get_html was called, I used:
This way, there is a consistent approach to implementation, and if the $request_type is consistently/accurately set, then the recaptcha will be properly presented without 'src=' error(s) causing the visitor to see that there is mixed content being presented.Code:<?php echo recaptcha_get_html($publickey, $resp->error, $request_type == 'SSL'); ?>
Hi mc
Looks like you have found a good solution to the problem of having different SSL and nonSSL domain names and hence different Google keys. For point 2 - the exact code that you suggest has already been implemented in the 1.51 version (great minds think alike :) )
Regards
David
Todayi was thinking about the solution(s) I posted and of course I didn't consider in which version of Zen Cart that the variable $request_type first appeared, so for those using older versions of Zen Cart I can not claim that my solutions (described or provided) will work.
I'll have to check out the new version of reCaptcha, although in review of the previous posts (Dr. Byte's I think) it seems like I'll have to incorporate the appropriate "event" notifier code in version 1.5 (or update to 1.5.1) to trigger the action(s).
I'm still considering implementing the method I described in my writeup and when I do, I'll post it. Referring to an alternate method of handling the keys associated with SSL and NONSSL to try to simplify "installation".
Someone sent me a private message asking for help with this mod. I'm answering it here so that others may benefit :)
Original Question:
Looking at the mod you mention the integration should be quite easy. It is essentially the same process as integrating my mod into any of the pages in a pre-1.51 cart.Quote:
Hi David,
I am using "Report Cheaper Price" Module from Zen Cart,
And I see your module "Google reCAPTCHA", and I want to integration your module can working with "Report Cheaper Price"
Can you help me on this?
Thank you very much of your time and help.
You need to add the code to display the reCAPTCHA to /includes/templates/YOUR_TEMPLATE/templates/tpl_report_a_price_default.php (see step 3 in the instructions) I suggest adding at around line 93.
If you see step 4a in the installation instructions and instead apply that to /includes/modules/pages/report_a_price/header_php.php at around line 44. You'll need to add theto the 'if' statement that is in the file (rather than use the 'if' statement in the instructions).Code:and $error == false
That should be it.
Regards
How would I disable this for the Write Reviews page and the Create Account page?
Found my answer in Post #63.
Hi David
Thanks for this great mod. After installing on my version 1.5.1 site which uses FEC, I found it doesn't work on my account create page. I have the Fast and Easy Checkout plugin, which has it own fec_create_account.php file, installed. If just add "$zco_notifier->notify('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK');" into the fec_create_account.php, there is no error message appeared when the input is wrong. Could you help?
I'm having some issues getting the captcha to work on the Contact Us page. It shows up fine, but if you fill out the form and leave the captcha blank, or type the wrong words, it still submits the form. No errors at all. It DOES show the captcha error if you forget to fill out part of the form, though.
Both the create account and new review pages work perfectly with the captcha. I tried manually adding the lines and I tried uploading all the files. Neither way worked.
Using this on Zen Cart v1.3.9.
Probably missing things from your 139 site that the plugin depends on.
Just solved the issue with the captcha not validating on the contact page.
I had a backup of the header.php file (without the captcha) in the contact us folder under pages. I named the backup 'header.php-bak.php' and it seems like Zen Cart was loading that file instead of the one with the captcha script! Renaming the backup file to 'backup-header.php.php' solved the issue. (Of course deleting or moving the backup file to another location fixes it as well.l)
Right. Any files matching the pattern "header_php*.php" will be auto-loaded.
Similar to ALL files ending in ".php".
So, in the future, instead of renaming "fred.php" to "fred-bak.php", rename it from "fred.php" to "fred.bak" or "fred.php.bak".
Basically, change the ".php" suffix instead of the prefix before it.
Hi guys
I have managed to setup a contact form as a sidebox. i wold love to have captcha on it is spammed like nothing. I have tested the Google recaptcha and works perfectly but it is way to big for a sidebox. I need it to be around 200px and if anyone has any idea if that is possible and how will be great.
Regards
Tassos
Not to belittle recaptcha, what about using a hidden field, that if content is present then not to submit your form? (Similar to what is done in ZC 1.5.1 on the contact us form?)
To answer the question, I thought there was some CSS associated with recaptcha, so you would have to shrink it, but realize the smaller you make it, the harder it is for a user to read and then submit the expected info which leads back to my previous portion of my answer.
Thanks for the mod, David.
I'm on 1.51, smart enough to follow the simple instructions...and it doesn't work. The recaptcha box displays, but entering the wrong text or entering nothing has no effect as the page still advances.
It's needed only for the account creation page so, after double-checking everything, I tried what was written earlier about the line "$this->attach($this, array..." and deleted the unneeded parts for Contact and Review and it still didn't work. My ZC was installed as 1.51, no upgrade, so another post with a similar issue does not apply. I tried the box in different places in tpl_modules_create_account and it was the same result each time.
There are no other mods for signing up, I'm using the standard process and with all products virtual so no shipping address asked for. Any ideas?
Sure all the files were uploaded correctly? (Not to say that you didn't try to upload them, but that the process of uploading didn't go as expected.)
Also do you have any files that were renamed to "hide" them, but they are still being loaded because they end in php?
Uploaded to correct template, etc?
Hi giftmeister, Not sure what has gone wrong. As you found out moving the box within the create account form shouldn't affect it. Removing the extra entries in the $this->attach.... should stop it being needed on those other pages. Can you check that it looks like
to just have it on the create account page.Code:$this->attach($this, array('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK'));
Regards
David
mc and David, I triple-checked all the obvious things.
The ZC installation is in a directory- xyz.com/abc - but that doesn't seem to be an issue to Google and I wasn't even able to enter the directory on the Google recaptcha page (no slashes allowed).
Then I just thought that it might be due to Java being disabled in my browsers, but I re-enabled it in IE and the page (refreshed, started over) still advanced without entering anything in the captcha box.
So, there is either something amiss with the installation or conflicting with another file/mod it would seem. I haven't looked at the newer installation instructions, but as I understand it is now possible to install google recaptcha without making modifications to any ZC 1.5.1 core files as a trigger was added in that could be used to provide the recaptcha. That said, an older version of the plugin provided direction to go into one (or more similar files) to add code to perform a check if the recaptcha was entered properly. If you look at those directions and then that file, you can see perhaps what is going wrong. There is a check that is needed: if the data is bad, then it stops flow and gives an error, if it is good, then it keeps on processing.
One line of code is added to the core page(s) where the Recap is needed. I have just one other mod- Export Shipping Info- and it doesn't affect the page where I need the Recap, tpl_modules_create_account.Quote:
it is now possible to install google recaptcha without making modifications to any ZC 1.5.1 core files
Does this require Java on a visitor's computer or is it simply Javascript? Many people don't have the former.
Thanks, mc and David. I'll try one more time...hope it works because this mod is the simplest of all the Captcha mods here.
Jeez, I figured it out- there's a mod I stopped using and didn't fully remove, Extra Fields On Customer Sign-Up. What I forgot were changes in includes/templates/create_account.php. Re-uploaded the original file and Recap works!
Sorry for the hassle and thanks for your time.
It relies on javascript not java
For 1.51 no core files have to be changed, just the template files (eg tpl_modules_create_account) for the pages you want the reCAPTCHA to appear on.
One question, did you upgrade to 1.51 or was it a clean install? If the former I would check that you have the correct version of the file /includes/modules/YOUR_TEMPLATE/create_account.php as it sounds from your description as if this could be the problem
Regards
David