after many hours of trying and searching to solve an issue with captcha issue and several faild attempts to fix the problem I decide to ask for your help, I have a web site on Joomla 2.5 I have a custom register form for new users and I want to add a captcha mechanism, where here what I made (i found it here in stackoverflow but i have some qusetions). So far I made the followings:
1)I enabled the capcha-recaptcha plugin and I enter private key and site key from google captcha
2)I set captcha-Recaptcha to Default captcha at global configuration
3)In my file template\mytemplate\html\mod_login\default.php
I enter the following code which I found here in stackoverflow
//php code
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');
//html code inside form tag
<div id="dynamic_recaptcha_1"></div>
So far so good it appears the captcha image and entry box but when I press submit button I receive Invalid token
I suspect that it has something to do with the following part of code which it should validate/proccess the form
$post = JRequest::get('post');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
die('Invalid Captcha');
}
in joomla in which file I should insert the validation code? I have tried in submit button at : template\mytemplate\html\mod_login\default.php
but nothing, I have tried also at com_users\controllers\registrattion.php still nothing any ideas where I should insert this part of code? in order to make it work?
Thnks in advance for your time!!
Regards, Jim