Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Andreas Neuber 6 years, 8 months ago.

Assigned support staff: Andreas Neuber.

Author Posts
March 27, 2013 at 10:34 pm #115433

Ian

Hi
This seems to be a very long ongoing issue but the solutions I have come across do not seem complete as yet.

In my particular case I have both the usual WordPress login screen and a custom theme login page.

I want the user to see either 'Log In' or 'Log Out' in my top navigation menu depending on if he is already logged in or not.

I achieved this by the following code in my functions.php file:
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'top-menu') {
$items .= '

  • <a href="'. wp_logout_url() .'">'. __('Log Out') .'</a>
  • ';
    }
    elseif (!is_user_logged_in() && $args->theme_location == 'top-menu') {
    $items .= '

  • <a href="**Website My Account Link OR wp-login.php**">'. __("Log In") .'</a>
  • ';
    }
    return $items;
    }

    The webpage link option takes the user to the translated theme login page which is preferable to the wp-login.php option which takes the customer to the WordPress generic login.

    Now if I use the theme login page URL option then the user will be taken to the English language Login page - not good! Although you can translate the menu in WordPress - you cannot use the Appearance - Menus method to translate the functions.php Log in/out URL automatically. So Using this method means I have to translate the WordPress generic login page and make it switchable between languages.

    I can see how to translate the WordPress Login page BUT I do not see how you switch between languages when landing on that page and it needs to be in two languages.

    If I try to use the Menu method then I am stuck with having both Login and Logout as required menu links which is counter intuitive and also wastes the space available in my navigation menu.

    So can you provide a method where I can use the functions.php method to provide a smart Log In / Logout which is translatable with code to effect it please?

    March 28, 2013 at 7:31 am #115458

    Andreas Neuber
    Supporter

    Languages: English (English ) German (Deutsch )

    Hello Ian,

    Interesting question - have you shared with any of my colleagues website credentials already?

    The topic ‘[Closed] Translating Logins Problem’ is closed to new replies.