WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
Doesn't work with qTranslate (16 posts)

  1. Tim Rogers
    Member
    Posted 3 years ago #

    I just realized that the contact form 2.9.8.5 (and previous ones) doesn't work on my localized page. It seems to have a problem with qTranslate. I'll try to explain my setup a little:

    I have 2 forms. One is the English default on:
    http://www.example.com/contact
    ...and the other is a German one on:
    http://www.example.com/de/contact
    Note the neat Url modification! It probably causes the issue.

    Anyway, when I enter data and press submit it results in:
    http://www.example.com/contact#FSContact1
    ...for the English one. The "successful sent" message appears, so no problem here. The German form however goes to:
    http://www.example.com/contact#FSContact2
    ...I think you can guess what's wrong here: Email isn't sent and clear English form is displaying for no reason.

    Are you able to fix this?

  2. Tim Rogers
    Member
    Posted 3 years ago #

    Dear Mike Challis,

    Could you please tell me if this can be fixed? Why don't you want to respond?

    This is a serious issue to me and I love (and must use) both plugins. qTraslate is a very popular plugin to enable us webmasters to create website in multiple languages...

    Regards,
    Tim

  3. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    Sorry for the delay, I was out of town.

    This is a qTranslate caused problem, quite possibly a design shortfall in qTranslate.
    Let me explain... qTranslate changes the URL to a path that does not actually exist.
    It adds a fake folder to the URL such as /fr/ for French. Because this folder does not actually exist, this causes a problem with the server environment variables. The URL is changed by qTranslate to include /fr/, but the server environment variable $_SERVER['HTTP_HOST'] is not. This is what causes the Form action URL to not work properly after selecting a qTranslate language.

    qTranslate is the cause if the problem.
    I am not able to troubleshoot qTranslate because I am not familiar with it's code or it's inner workings.

    I have contacted the qTranslate developer for support. You are welcome to join the conversation at their support forum.
    http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=2035

    Mike

  4. Tim Rogers
    Member
    Posted 3 years ago #

    Hello Mike,

    Thank you for looking into this. Sorry, I really thought your plugin isn't able to handle this correctly.
    Anyway, I posted in the support forum you've mentioned. I hope this gets fixed soon because it's really annoying for my German visitors.

    Tim

  5. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    I have posted a requests for help in the qTranslate forum, they have not responded.

    Anybody you tried GTranslate?
    http://wordpress.org/extend/plugins/gtranslate/

    I use GTranslate at
    http://www.fastsecurecontactform.com/

  6. Tim Rogers
    Member
    Posted 3 years ago #

    For me GTranslate isn't an acceptable alternative. The translations are really sloppy and I can't use my own texts for the different languages.

    Too bad the author of qTranslate doesn't want to answer...

  7. flavigne
    Member
    Posted 2 years ago #

    I have encountered this error today and I have fixed if for my site. It's a bit of a hack and it might not work for everybody, but there you are:

    In /wp-content/plugins/si-contact-form/si-contact-form.php near line 224 you should have

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    change it for

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    }

    I hope it helps

  8. Azim Hikmatov
    Member
    Posted 2 years ago #

    I've tried following code, and odd enough, it did work
    (though URLs don't look that good after submission).
    Let's say, you've got 2 langs, english and french, english being a default and french second one.
    Go to /wp-content/plugins/si-contact-form/si-contact-form.php as mentioned in previous post and find those lines mentioned.

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    and replace 'em with

    if(get_locale() == 'en_US') {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    } else {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].'/fr/'.$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].'/fr/'.$_SERVER['REQUEST_URI'];
    	}
    }

    May not work but who knows...

  9. icutanda
    Member
    Posted 2 years ago #

    Hi All,

    Flavigne and Seezer, I can solve it myself with your instructions. I have a qtranslate installed with two forms. One in Spanish and other in Catalan. I put this code in si-contact-form.php.

    if(get_locale() == 'es_ES') {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    } else {
    	if ( getenv('HTTPS') == 'on' ) {
    		 $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    	} else {
    		 $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    	}
    }

    Thanks for all.

  10. zajda61
    Member
    Posted 2 years ago #

    thanks so much for the great advice,...... can you please advise, what would the php code for 3 languages​​? I am php loser, ...

  11. Jan van Dank
    Member
    Posted 2 years ago #

    Probably something like:

    switch ( get_locale() ) {
    	case 'AAA':
    	case 'BBB':
    		if ( getenv('HTTPS') == 'on' ) {
    			$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    		} else {
    			$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    		}
    		break;
    	default:
    		if ( getenv('HTTPS') == 'on' ) {
    			$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    		} else {
    			$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    		}
    }
    Just replace AAA and BBB with the language codes. The third one will be your default language... Didn't test it though!
    I'm still hoping for an internal solution from Mike Challis as I don't really want to edit the plugin's code.

  12. phdsigns
    Member
    Posted 2 years ago #

    Thank you very much Jan van Dank, this is working mighty fine :)

  13. Jan van Dank
    Member
    Posted 2 years ago #

    @phdsigns
    I'm glad that I was able to help you. :)

    Still waiting for a "official" solution from the plugin developer though...
    Maybe you can add something like a compatible mode option?
    -> "[x] Make compatible to qTranslate"

    Regards,
    Jan

  14. Mike Challis
    Member
    Plugin Author

    Posted 2 years ago #

    I cannot find an acceptable solution. $_SERVER['REDIRECT_URL'] is not even available on my Apache server with PHP Version 5.3.6

    I hesitate to cause other problems
    PS the current code in the plugin is:

    // set the type of request (SSL or not)
    if ( is_ssl() ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    It would be nice if the qTranslate author could address this issue himself.

  15. Jan van Dank
    Member
    Posted 2 years ago #

    @Mike Challis
    Thank you for looking into this again! Well, you could call it "[x] Make compatible to qTranslate (experimental)". ;-)

  16. Milber
    Member
    Posted 2 years ago #

    What works for me is changing

    if ( is_ssl() ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //
    }

    to

    if ( is_ssl() ) {
        $form_action_url = qtrans_convertURL($_SERVER['REQUEST_URI']);
    } else {
        $form_action_url = qtrans_convertURL($_SERVER['REQUEST_URI']);
    }

    I haven't tested if this works for SSL - for normal http it's fine. This doesn't solve the re-direct problem either. I guess it would need some work around line 840 similar to the changes above.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic