After upgrading to Joomla 3.5 the captcha is no more visible in both, user registration and ask a question.
VM 3.0.14
J 3.5.0
Confirm this is happening on mine too same versions.
The recaptcha div is not populated.
<div id="dynamic_recaptcha_1"></div>
EDIT: If I set version to 1.0 in the plugin settings it works so obvoiusly a Version 2.0 problem.
It works if I comment out line 63 and add the following to the else for the version check at line 61. in [ROOT]/plugins/captcha/recaptcha/recaptcha.php :
$file = 'https://www.google.com/recaptcha/api.js?onload=JoomlaInitReCaptcha2&render=explicit&hl=' . JFactory::getLanguage()->getTag();
JHtml::_('script', $file);
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
$document = JFactory::getDocument();
$theme = $this->params->get('theme', 'clean');
$document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
. 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
. '});});'
);
I assume it isn't finding plg_captcha_recaptcha/recaptcha.min.js possibly due to a wrong path?
Hi mirrorsandglass,
Works for me, but only for askaquestion, not for virtuemart registration...
Works for both things in your sites?
Thanks!
Reports of Captcha problems elsewhere for other extensions. Seems the Joomla devs have not made the new version 2 backwards compatible.
Back to Joomla 3.4.8 and Recaptcha not work in registration page (1.0 or 2.0).
I try with protostar and same thing...
Quote from: franayala on March 24, 2016, 12:02:28 PM
Hi mirrorsandglass,
Works for me, but only for askaquestion, not for virtuemart registration...
Works for both things in your sites?
Thanks!
Hi franayala,
Yes it works for me in both askaquestion and registration.
Sorry for the obvious but make sure you have the tick box checked in Configuration/Configuration/Shop
Hi mirrorsandglass!
No worries. ;)
This option is checked, but not works for me :(
Any idea?
Thanks a lot!!
Hi franayala,
Only other things I can think of causing this problem for registration are your template, another plugin or a script conflict.
Without knowing your site it would be impossible to tell.
Try without template overrides or using just the default template.
If you have any other plugins that are used during registration try de-activating them one at a time, if you can, and see if that solves the problem.
Firebug in Firefox is great for spotting script conflicts.
Sorry I can't be more help.
Some information:
https://issues.joomla.org/tracker/joomla-cms/9623
http://tranduyhung.joomla.com/21-joomla-3-5-display-recaptcha-in-custom-component
Quote from: mirrorsandglass on March 23, 2016, 17:34:05 PM
Confirm this is happening on mine too same versions.
The recaptcha div is not populated.
<div id="dynamic_recaptcha_1"></div>
EDIT: If I set version to 1.0 in the plugin settings it works so obvoiusly a Version 2.0 problem.
If select the version of 1, and then somehow it works
I loaded the old file (/plugins/captcha/recaptcha/recaptcha.php), also worked in version 2.0 but with some flaws
Quote from: mirrorsandglass on March 23, 2016, 17:56:13 PM
It works if I comment out line 63 and add the following to the else for the version check at line 61. in [ROOT]/plugins/captcha/recaptcha/recaptcha.php :
$file = 'https://www.google.com/recaptcha/api.js?onload=JoomlaInitReCaptcha2&render=explicit&hl=' . JFactory::getLanguage()->getTag();
JHtml::_('script', $file);
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
$document = JFactory::getDocument();
$theme = $this->params->get('theme', 'clean');
$document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
. 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
. '});});'
);
I assume it isn't finding plg_captcha_recaptcha/recaptcha.min.js possibly due to a wrong path?
Thank you.
It helped for registration form
Joomla 3.5.1 has no mention of Captcha fixes.
Just tested my installation again with J3.5.1 and VM 3.0.14 on Firefox 45.0.1 with these results:
Does not show on VM 'Recommend to a friend' and 'Ask a Question' even with Beez template. When you click Submit, it displays 'The CAPTCHA solution was incorrect.'
Does however show and work on VM Cart / Checkout page when clicking on the Forgot Password and Forgot Username links.
The fix for /plugins/captcha/recaptcha/recaptcha.php enables Recaptha to work on VM and also on at least one other component that had the same problem.
Maybe easier to understand the code change here:
http://forum.joomla.org/viewtopic.php?f=710&t=874688&start=30#p3385872
this forum post got the same problem:
http://www.vi-solutions.de/en/forum-index/19-joomla-extension-visforms/899-graphic-error-with-captcha-recaptcha-2-0
and the solution seems to be more elegant:
$captcha = JCaptcha::getInstance('recaptcha');
$html = $captcha->display(null, 'dynamic_recaptcha_1', 'required');
maybe wrapped with a few checks would work even better:
if (class_exists('JCaptcha') && (method_exists('JCaptcha', 'getInstance')))
{
$captcha = JCaptcha::getInstance('recaptcha');
if (method_exists($captcha, 'display'))
{
$html_captcha = $captcha->display(null, 'dynamic_recaptcha_1', 'required');
}
}
best regards, stan
Yes, this worked for me:
Quote from: mirrorsandglass on March 23, 2016, 17:56:13 PM
It works if I comment out line 63 and add the following to the else for the version check at line 61. in [ROOT]/plugins/captcha/recaptcha/recaptcha.php :
$file = 'https://www.google.com/recaptcha/api.js?onload=JoomlaInitReCaptcha2&render=explicit&hl=' . JFactory::getLanguage()->getTag();
JHtml::_('script', $file);
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
$document = JFactory::getDocument();
$theme = $this->params->get('theme', 'clean');
$document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
. 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
. '});});'
);
I assume it isn't finding plg_captcha_recaptcha/recaptcha.min.js possibly due to a wrong path?
in resolving these problems:
Quote from: biltong on April 06, 2016, 15:09:09 PM
Joomla 3.5.1 has no mention of Captcha fixes.
Just tested my installation again with J3.5.1 and VM 3.0.14 on Firefox 45.0.1 with these results:
Does not show on VM 'Recommend to a friend' and 'Ask a Question' even with Beez template. When you click Submit, it displays 'The CAPTCHA solution was incorrect.'
Does however show and work on VM Cart / Checkout page when clicking on the Forgot Password and Forgot Username links.
stAn99: I prefer elegant solutions myself but time does not permit at the moment!
Quote from: mirrorsandglass on March 23, 2016, 17:56:13 PM
It works if I comment out line 63 and add the following to the else for the version check at line 61. in [ROOT]/plugins/captcha/recaptcha/recaptcha.php :
$file = 'https://www.google.com/recaptcha/api.js?onload=JoomlaInitReCaptcha2&render=explicit&hl=' . JFactory::getLanguage()->getTag();
JHtml::_('script', $file);
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
$document = JFactory::getDocument();
$theme = $this->params->get('theme', 'clean');
$document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
. 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
. '});});'
);
I assume it isn't finding plg_captcha_recaptcha/recaptcha.min.js possibly due to a wrong path?
Thanks for that! It works but not 100%, if you go to Backend>Extensions>Plugins>Captcha-Recaptcha and try to resize the Recaptcha it would not work. Which means that Recaptcha 2 is stuck to its Default size and viewed from Mobile device it is far from responsive - does not fit on mobile screen well. If the output resolved to Compact size it would have been different story but the above fix does not fix this (the option to rsize Recaptcha 2 in Backend is redundant).
Please note the difference between the sizes as per attached image.
misholini - I'm getting the same as you, Compact is same as Default size and not responsive.
J3.5.1, VM 3.0.14, PHP 5.6.19
Recaptcha 2 runs ok for me on another extension (Alfcontact) and resizes between Defaulft and Compact size fine with the original code in recaptcha.php and without the fix below:
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
$document = JFactory::getDocument();
$theme = $this->params->get('theme', 'clean');
$document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
. 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
. '});});'
);
Commenting out below line only breaks working Recaptcha in my Alfcontact:
//JHtml::_('script', 'plg_captcha_recaptcha/recaptcha.min.js', false, true);
.. So I remove the comment and bring this line to it's original state.
I also keep the rest of the patch above to keep unhappy extensions including Virtuemart in order for them to show Recaptcha 2. Unfortunately the size of Recaptcha 2 in Virtuemart can not be controlled via the plugin's settings (Default, Compact).
If Recaptcha 2 works fine with some extensions without the necessity to patch the recaptcha.php file then I hope this will be the case with Virtuemart soon.
After half a day and trying multiple workaround options I finally found 1 that is close to perfect (on Joomla 3.5.1 in combination with VM 3.0.16).
First make sure that Captha is enabled and the key are inserted within the default Joomla plug-in.
Enable Captcha - ReCaptcha on Joomla > Global Configuration > site.
Set Captcha to - Use Default - on Joomla > Global configuration > Users.
Check Use Captcha for Registration on VM > Configuration > SHOP.
Check Use ReCaptcha for recommendations and 'Ask a question' onVM > Configuration > SHOPFRONT.
Now to edit the php files in the overides (for now until VM implements this). All the forms and captcha request are the same. Search for "// captcha addition" to find its correct location within the form file where the captacha is requested.
For example Ask a Question: Original file located at \componentes\com_virtuemart\views\askquestion\tmpl\form.php
Overide file: <your template> > html > com_virtuemart > askquestion > form.php around line 103 change:
// captcha addition
if(VmConfig::get ('ask_captcha')){
JHTML::_('behavior.framework');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>
<div id="dynamic_recaptcha_1"></div>
<?php
}
// end of captcha addition
to
// captcha addition
if(VmConfig::get ('ask_captcha')){
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
$recaptcha = $dispatcher->trigger('onDisplay', array(null, 'dynamic_recaptcha_1', 'class=""'));
?><?php echo (isset($recaptcha[0])) ? $recaptcha[0] : '';?>
<?php
}
// end of captcha addition
Kind regards