?
avatar queengab
queengab
22 Mar 2015

Hi,

thanks for your work on this plugin! I update my recaptcha.php code with your last edit and solve some issues. Now i'm trying to do something ... unusual.

I'm trying to include the recaptcha in my own plugin that simply have a form, write on db data, send data via post ajax with return json error, and send mail.
I used the method above on my html page and so add a dvi before the send button:

<?php
JPluginHelper::importPlugin('captcha');
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>

from here :http://stackoverflow.com/questions/12840015/how-to-use-joomla-recaptcha-plugin-to-my-custom-module, and i can view it!

But now two things are strange:
The captcha won't load when i simply refresh the page but only when i refresh with erase browser cache,
The onInit initialise the plugin only one time per session?
But most important how can i verify capctha on submit?
I tried it, on my php send file but the page return me a ajax error.

//Verify captcha
$post = JFactory::getApplication()->input->post;

JPluginHelper::importPlugin('captcha');
$dispatcher = JEventDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if($res) === TRUE) {
$jsonObj = sprintf($status, 1, "ok");
}
else
{
$jsonObj = sprintf($status, 0, "Insert captcha");
}

Have you some suggestions, please?
Thanks
Gabriele

avatar queengab queengab - open - 22 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 22 Mar 2015
Category Plugins
avatar queengab
queengab - comment - 23 Mar 2015

I found solution to verification here:
http://stackoverflow.com/questions/28065375/how-to-add-recaptcha-to-contact-form
Watch peter response!

I only have to understand why recaptcha won't load each time i refresh the page.
Suggestions?

Thanks
Gabriele

avatar gbula
gbula - comment - 23 Mar 2015

I think it's a bug in file /plugins/captcha/recaptcha/recaptcha.php in line 80.
Instead of
. '}'
should be:
. '};'
Lack of semicolon causes an javascript error when after code generated by the captcha plugin exists some other code.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6543.
avatar queengab
queengab - comment - 23 Mar 2015

Thanks Gbula!
I tried it but without fortune.
I don't know but seems there be. maybe in my case, a conflict with mootols or jquery.

Is there a way to force always initliase a plugin in the same session?
[code]$dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onInit','dynamic_recaptcha_1'); ?>[/code]

I don't know how to debug it...
In console message there are no errors.

I'm feeling thus close to solution but thus far from handle it :)

I'll do more tries.
Thanks
Gabriele

avatar kinwolfqc
kinwolfqc - comment - 24 Mar 2015

I am in the same boat. reCaptcha simply won't load on a refresh.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6543.
avatar brianteeman brianteeman - change - 18 Feb 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-02-18 08:54:39
Closed_By brianteeman
avatar brianteeman brianteeman - close - 18 Feb 2016
avatar brianteeman
brianteeman - comment - 18 Feb 2016

As the recaptcha has been refactored a lot and considerable changes have been made since this was submitted I am assuming that it has already been fixed elsewhere and am closing this. If you still have the problem please update the issue with the correct line number in the current version of Joomla and it can be reopened


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6543.

Add a Comment

Login with GitHub to post a comment