Captcha not working on Agent Form

5 posts in this topic


I see there was a previous post on this but I am unable to see a resolve.

I have added recaptcha to my site and added the appropriate keys and script. The recaptcha field appears on the Agent Form - but if I enter content and hit submit (without checking the recaptcha box) the form submits anyway.

You can see the set up example here

Is there a fix for this? I have version 2.10 (latest of the component installed)

Thank you.


Share this post

Link to post
Share on other sites

You have to add some code to the following file components/com_bt_property/controllers/agent.php


on about line 27 find "function sendmsg(); { "

and copy the following:

	function sendmsg() {

		JRequest::checkToken() or jexit('Invalid Token');
                $captcha = JFactory::getConfig ()->get ( 'captcha' );
                $return_url = base64_decode(JRequest::getVar('return',''));

        if($captcha) {
            $reCaptcha = JCaptcha::getInstance($captcha);
            $checkCaptcha = $reCaptcha->checkAnswer('');

                $msg= JTEXT::_('Incorrect CAPTCHA entered. Please try again.');
                    $this->setRedirect($return_url, $msg);
                    $this->setRedirect(JRoute::_('index.php'), $msg);

		$app = JFactory::getApplication();
		$agent = JUser::getTable();
		$name = $app->input->getString('name');
		$email = $app->input->getString('email');


Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now