• Resolved Uobet

    (@uobet)


    Hi,

    I’ve been fighting with the following problem for a few days now.

    I am developing a multilingual homepage, in two languages (German and Italian), using the plugin qtranslate.

    Now I’ve chosen wp-members for building up a simple member area.

    On one page I placed the shortcode [wp-members page=”login”].
    The login is working perfectly in both languages.

    The logout works fine with the first language (German) . After clicking on “logout” the front page https://mydomain/name_frontpage is opened.

    With the second language (Italian), when clicking on “logout” the message “page not found” appears.
    In this case WordPress does not select – as one would expect – the Italian version of the page, i.e. https://mydomain/name_frontpage/?lang=it as I would expect but
    https://mydomain/pagename/?lang=it?a=logout
    This page can’t obviously be found because the URL of the page (where the above mentioned login-shortcode is placed) would be https://mydomain/pagename/?lang=it
    (N.B. It’s the a=logout, which makes the difference.

    Can anybody help me?

    S

    P.S. I also tried to redirect to another page. The problem remains the same: With the first language everything works, with the second language not.

    https://www.ads-software.com/plugins/wp-members/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Uobet

    (@uobet)

    I’ll try again as there hasn’t been any feedback so far:

    I’ve installed the multilingual plugin qtranslate and my login/logout-page has (as typical for qtranslate) two different slugs for each language.

    The logout from the German slug
    https://www.mydomain/GermanPageName/?a=logout
    works.

    The logout from the Italian slug
    https://www.mydomain/ItalianPageName/?lang=it?a=logout
    doesn’t work (message “page not found”).

    Can anybody help me, also with just giving me an advice of where to go to search?

    Best Regards

    S

    Plugin Author Chad Butler

    (@cbutlerjr)

    Basically, the plugin appends an query string to the URL for logging out. However, in this case, there is already a querystring in the URL that the plugin is unaware of, so it is actually creating an invalid URL (it needs an “&” where the “?” is).

    This can be resolved with the wpmem_logout_link filter, which allows you to filter the logout link. You could do this a number of ways:

    add_filter( 'wpmem_logout_link', 'my_logout_link' );
    function my_logout_link( $string ) {
    	return 'https://mydomain.com/?a=logout';
    }

    That’s the simplest solution. A more complex but more elegant approach would be to remove the logout querystring, check to see if the remaining string contains a querystring (with “?”), and if so add the logout back with “&”, otherwise return the original logout link:

    add_filter( 'wpmem_logout_link', 'my_logout_link' );
    function my_logout_link( $string ) {
    	$str_chk = substr( $string, 0, -9 );
    	if( strpos( $str_chk, '?' ) !== false ) {
    		return $str_chk . '&a=logout';
    	} else {
    		return $string;
    	}
    }

    Those aren’t necessarily the only possibilities.

    Thread Starter Uobet

    (@uobet)

    Hi Chad,

    it works.

    Problem solved.

    Thank you very much for your help and also for your great plugin!

    S

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp-members – logout in second language not working’ is closed to new replies.