• Resolved arminghasemazar

    (@arminghasemazar)


    Hi. I’m using your premium pop up login plugin. My site has both English and Persian languages. I’m using TranslatePress for translation. When a customer is on Persian, “?lang=fa” is added to the end of all URLs. However, this doesn’t work when customers log in or register. The reason is that in the admin setting all redirect fields only accept slugs without considering the referring page’s language. Therefore, regardless of the language chosen, the plugin redirects customers to the page admin defines. Any tweak or snippet to solve this?

    I tried to use a shortcode in redirect field changing redirect URL based on language but not worked since the field does not render shortcodes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author xootix

    (@xootix)

    Hello @arminghasemazar

    There are redirect filters available.
    Please put this code in your functions.php.
    I have not tested it, but hopefully it should work.

    //Add hidden current language code to forms
    function xoo_cu_el_language_code(){
    	if( !isset( $_GET['lang'] ) ) return;
    	?>
    	<input type="hidden" name="xoo-el-lang-code" value="<?php echo $_GET['lang']; ?>">
    	<?php
    }
    add_action( 'xoo_el_register_form_end', 'xoo_cu_el_language_code' );
    add_action( 'xoo_el_login_form_end', 'xoo_cu_el_language_code' );
    
    //Fetch the language code once form is submitted & add to current redirect URL
    function xoo_cu_el_redirect_lang( $redirect ){
    	if( isset( $_POST['xoo-el-lang-code'] ) ){
    		$redirect .= '?lang='.$_POST['xoo-el-lang-code'];
     	}
     	return $redirect;
    }
    add_filter( 'xoo_el_login_redirect', 'xoo_cu_el_redirect_lang' );
    add_filter( 'xoo_el_registration_redirect', 'xoo_cu_el_redirect_lang' );
    Thread Starter arminghasemazar

    (@arminghasemazar)

    Perfect. Solved. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘redirect links are not compatible with multi-language websites’ is closed to new replies.