Add google CAPTCHA in register page in Magento
I have tried to integrate recaptcha and I was partially successfully. I have tried for customer registration page only. But this can be applied to other forms as well. Here is the link where to download the recapthcha file:
http://recaptcha.net/plugins/php/
Here is the step:
Step-1
Copy the recaptchalib.php file in to /app/code/core/Mage/Customer/controllers directory and app/design/frontend/default/default/template/customer/form directory.
Step-2:
Open app/design/frontend/default/yourstore/template/customer/form/register.html .
Go to line 57 and add the following line:
<?php
require_once(‘recaptchalib.php’);
$publickey = “xxxxxxx “; // you got this from the signup page
?>
<li>
<div>
<label for=”captcha_field”><?php echo recaptcha_get_html($publickey) ?> <span class=”required”>*</span></label><br/>
</div>
</li>
Step-3
Open app/code/core/Mage/Customer/controllers/AccountController.php file and go to line number 230
replcae the following lines:
$validationResult = $customer->validate();
if (true === $validationResult ) {
by
require_once(’recaptchalib.php’);
$privatekey = “xxxx”; // This is the private key you get from recpatcha registration
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
$validationResult = $customer->validate();
if (true === $validationResult && $resp->is_valid) {
Step-4
Then cache in admin and that is it.
Such a nice post……keep posting…….:)Such a nice post……keep posting…….:)