reCaptcha and Multi language

pmarty 08 Oct, 2012
Hello,

Working with chronoforms 3.2 on J1.5, I have a problem with 2 plugins activated :
[list]
  • reCaptcha
  • Multilanguage
  • [/list]
    ReCaptch plugin is at first position in the plugin order page

    Everything is ok if the form is filled without error on recaptcha.
    But if reCaptcha is entered wrong, this warning is displayed

    "The reCAPTCHA wasn't entered correctly. Go back and try it again
    ( reCAPTCHA said: incorrect-captcha-sol )"


    And the form shows only the language strings instead of their translations!

    I made another test:
    If I place the MultiLanguage plugin at first place in Plugin Order page, and enter a wrong recaptcha code, the above warning is displayed of course, the language strings are replaced by their translations, fine, BUT the recaptcha does not appear...
    It only displays

    {ReCaptcha}


    where it was before.

    How can I have both reCaptcha and Multi Language working on the same form?
    Thanks for your help
    Philippe
    GreyHead 08 Oct, 2012
    Hi pmarty,

    It looks like this is a ChronoForms v3 bug that has never come to light before. The Plug-ins code is checking which plug-ins to run and blocking ReCaptcha when the page reloads. I think I have a fix here but please back up the file before testing.

    You need to edit components/com_chronocontact/libraries/plugins.php and look for a code block near the end like this. Comment out the existing block and replace it with this one
    			if ( count( $plugins ) ) {
    				require_once JPATH_SITE."/components/com_chronocontact/plugins/".$ava_plugin.".php";
    				${$ava_plugin} = new $ava_plugin();
    				$params = new JParameter( $plugins[0]->params );
    				$methods = get_class_methods( ${$ava_plugin} );
    				if ( in_array( 'onsubmit', $methods ) &&
    					( in_array( 'ONSUBMIT', $events ) || in_array( 'ONLOADONSUBMIT', $events ) ) &&
    					$emailevent ) {
    					if ( $params->get( 'onsubmit' ) == $emailevent ) {
    						${$ava_plugin}->onsubmit( 'com_chronocontact', $params , $plugins[0] );
    					}
    				}
    				if ( in_array( 'onload', $methods ) &&
    					( in_array( 'ONLOAD', $events ) || in_array( 'ONLOADONSUBMIT', $events ) ) ) {
    					$MyForm->formrow->html = ${$ava_plugin}->onload( 'com_chronocontact', $plugins[0], $params, $MyForm->formrow->html );
    				}
    			}

    The changes are in the lines starting if ( in_array( 'onsubmit', $methods ) and if ( in_array( 'onload', $methods )

    Bob
    pmarty 08 Oct, 2012
    Well,
    I replaced the code but with no success.
    As my client need a fast answer I have moved from reCaptcha to "Image Validation", which works fine. But I think this little bug may bother some users.
    GreyHead 08 Oct, 2012
    Hi pmarty,

    I'm sorry about that - the changed code works OK on my little test form here.

    I've never seen this particular bug reported before and ChronoForms v3 hasn't been updated for a long time so my guess is that it is unlikely that Max will fix it :-(

    Bob
    pmarty 08 Oct, 2012
    Anyway, thank you Bob very much for the debugging, I'll give another try when it will be easier for me.
    And I understand that bugs on V3 are not really supported.

    Thanks again.
    Philippe
    This topic is locked and no more replies can be posted.