Captcha misentry forces registering users back to home page?

I realize that this may have already been discussed, but I cannot find it through the search on this site! So, I am posting this, hoping for a possible tweak or fix or suggestion from someone.

I see that if someone tries to register on the site and misenters the captcha, they are redirected back to the home page. Does this have an intended purpose, besides the fact that it would TERRIBLY annoy a potential member of my site so badly that they give up right away and forget about trying to register?!

  • Lazy coding by the developer who wrote the captcha plugin?

    Check out it's start.php - look for the register error message call and add a forward(REFERER); right after it

  • Isn't it considered a core plugin? It came with the download.

    I see line 115:

            register_error(elgg_echo('captcha:captchafail'));

    right after, there is the following:

    return false;

  • I tried placing the code there, as you said, and it is still acting the same way. Maybe I am not getting it right. Could you paste the whole change for the function? Or is it possible it is another problem? ...Basically, I would like the form to return, with the data the person had entered (so that it is not lost for them!) and then they just have to re-enter the PW and the captcha again and they can register.

  • Yes, it is a core plugin. Try putting the forward directly after the register_error and before the return false.

    As to saving all the data on registration form. Elgg doesn't do that right now. Please open a ticket on Trac and request that the registration form be made sticky.

  • This is what I have, but it is still taking me to the home page when I hit the Register button:

        function captcha_verify_action_hook($hook, $entity_type, $returnvalue, $params)
        {
            $token = get_input('captcha_token');
            $input = get_input('captcha_input');

            if (($token) && (captcha_verify_captcha($input, $token)))
                return true;

            register_error(elgg_echo('captcha:captchafail'));
            forward(REFERER);

            return false;
        }

  • Have you set the value of REFERER? If you haven't it's going to go to the Home page.

    Try

    forward($_SERVER['HTTP_REFERER']);

  • REFERER is defined in Elgg 1.7.2

  • Cash, how do I get it to stop redirecting back to the home page? I just want it to at least stay on the same page. Sticky form would be even better, but it is definitely WAY to abrupt to be taken back to the home page because you don't enter the right characters for the captcha.