Theme My Login and WPML

Theme my login can enhance members’ functionality for multi-lingual websites if you use the following snippet to redirect the login form to the appropriate language.

//CHANGE REDIRECT TO LOGIN PAGE BASED ON LANGUAGE - LOST PASSWORD
add_filter('tml_redirect_url', 'my_tml_redirect_lostpassword', 10, 2);
function my_tml_redirect_lostpassword($url, $action){
    if ( 'lostpassword' == $action ){
        if(ICL_LANGUAGE_CODE=='fr'){ // use the language parameter of your choice
            $login_url = site_url('/fr/connexion/', 'https'); // use http if not a secure website
        }
        else
        {
            $login_url = site_url('/login/', 'https');// use http if not a secure website
        }
         //add query arg for checkemail
        $login_url = add_query_arg(array('checkemail' => 'confirm'), $login_url);
    }
    return $login_url ;
 
}

Sourced here.

Additionally, you can use the Theme My Login templates and ICL_LANGUAGE_CODE if statements to translate the plugin further.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.