How do I integrate RECAPTCHA into Magento sign up page?

Follow the instruction then this will be very easy to solve this problem

app/design/frontend/base/default/template/customer/form/register.phtml

Put this code for your any desired place .

————————————————————
require_once ‘lib/recaptcha/recaptchalib.php’;
$publickey = “xxxxxxxxxxxxxxxxxxxxxxxxxxx’”; // you got this from the signup page

# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

echo recaptcha_get_html($publickey, $error);

———————————————

app/code/core/Mage/Customer/controllers/AccountController.php

Go to createPostAction function

if ($this->getRequest()->isPost()) {
$errors = array();
—————————————————-

/***** start code for recaptcha ***/
require_once ‘lib/recaptcha/recaptchalib.php’;
$privatekey = ‘xxxxxxxxxxxxxxxxxxxxxxxxxxx’;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$this->getRequest()->getParam(‘recaptcha_challenge_field’),
$this->getRequest()->getParam(‘recaptcha_response_field’));
if ($resp->is_valid) {
// take no action
} else {
# set the error code so that we can display it
$errors[] = $resp->error;
}

/*** end of recaptcha option ****/
——————————————————————-
if (!$customer = Mage::registry(’current_customer’)) {
$customer = Mage::getModel(’customer/customer’)->setId(null);
}

Try this!

2 thoughts on “How do I integrate RECAPTCHA into Magento sign up page?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s