User tests: Successful: Unsuccessful:
This change prevents the plugin parameters are destroyed if the captcha plugin is loaded more than once on the same page.
#6674
Create two captcha fields in the same page through a form with type="captcha" (I use different "namespace" for each field)
Two captcha in the same page.
Error: reCAPTCHA plugin needs a site key to be set in its parameters. Please contact a site administrator.
Joomla 3.4.1
The fist time the captcha plugin is loaded, the _load function in the captcha library convert the plugin params from string to a Registry object, this is correct, but the second time the plugin is loaded, the library put the already converted params inside a new Registry object and the plugin params can't be used anymore.
File: libraries/cms/captcha/captcha.php
Line: 233
This issue can be fixed by checking if the plugin params is already a JRegistry object.
if (!($plugin->params instanceof JRegistry))
{
$params = new Registry($plugin->params);
$plugin->params = $params;
}
Please note. With the current version of Recaptcha (reCAPTCHA API version 2.0), you can have multiple recaptchas on one page, and this is the first step to achieve this feature.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
Title |
|
||||||
Rel_Number | 0 | ⇒ | 6674 | ||||
Relation Type | ⇒ | Pull Request for |
Title |
|
Easy | No | ⇒ | Yes |
Yes, do you have a demo page, with the code, also with a example from the form
@jeffchannell proposed the same code here. http://issues.joomla.org/tracker/joomla-cms/8275
I have tested this item successfully on 2296e66
As @smz nothing gets broken by this Patch. Thanks.
Milestone |
Added: |
||
Status | Pending | ⇒ | Ready to Commit |
RTC. Thanks
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-11-11 08:54:42 |
Closed_By | ⇒ | wilsonge |
Labels |
Removed:
?
|
Test OK.
Partial test:
@mepsteinj: If you can provide a test case we could more easily test the fixed functionality...