What?
This is an extract from a forum which solved our problem for why the ReCaptcha part disappears from the user registration form. We have Joomla 2.5.16 installed and no new updates for a plugin that comes with Joomla 2.5 install.

How?
Source: Joomla! • View topic - Cannot get recaptcha to display on registration form...
There are two solutions I have found that fix the problem:

Method #1
I prefer this method as it changes less code and is more likely to be supported in a Joomla update. Open the file /plugins/captcha/recaptcha/recaptcha.php and find the following 3 lines of code :

const RECAPTCHA_API_SERVER = "http://api.recaptcha.net";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";
and change these to
const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";


Method #2
If method #1 didn't work for you then if the following code works, it's because Google have changed where they're storing the API (again).

This overrides the Core Joomla code for ReCaptcha:

1. Open the file: /plugins/captcha/recaptcha/recaptcha.php

2. Find the following string in the OnDisplay function:
return '<div id="dynamic_recaptcha_1"></div>';
3. and replace with:
// Replace YOUR_KEY with your public key

return '<div id="dynamic_recaptcha_1">
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=YOUR_KEY"></script>
<noscript><iframe src="http://www.google.com/recaptcha/api/noscript?k=YOUR_KEY" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"></noscript>
<script type="text/javascript">
window.onload = function() {
Recaptcha.focus_response_field();
}
</script>
</div>';
	}

Additional
  • This applies to a case where the code WAS working and without any changes to the server (no updates), and the recaptcha simply stopped displaying.
  • Public Key and Private Key have been setup in the Joomla Core Plugin.
  • Set to display in both User Registration and Global Configuration.
  • K2 is NOT installed.

Add comment


Send

Comments   

0 Smith Saturday, 31st October 2015, 6:30 am
Article useful. Thank you