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 thread is resolved. Here is a description of the problem and solution.

Problem:
The user was having an issue with the plugin, when he switched to the secondary language in the admin top bar, the logout link does not work anymore and only redirects to the homepage without logging out the user.
Solution:
It is a compatibility issue and we could solve it by patching the plugin. The patch is changing or commenting line 151 of the same file "/classes/plugin.php" with the following.

return $this->user_trailingslashit( site_url( '/', $scheme ) . $this->new_login_slug() );

0% of people find this useful.

This topic contains 18 replies, has 3 voices.

Last updated by giulieteA 5 months ago.

Assigned support staff: Jamal.

Author Posts
April 30, 2019 at 3:30 am #3707759

susanS-5

I have installed WPS Hide Login plugin to customize the login url (eg domain.com/custom-login) and the issue that I have encountered is users applying the secondary language will logout with 404 error.

Please help, thanks.

April 30, 2019 at 10:23 am #3710323

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

As of now, the "WPS Hide Login" plugin is not listed within our compatible plugins.
https://wpml.org/documentation/plugins-compatibility/?wpv_view_count=119945&dev=0&wpv-plugin-functionality=0&wpv_post_search=hide&wpv_filter_submit=Search

I suggest you use one of the compatible plugins.

I can also create a test server for you, if you are able to reproduce the issue there, I might escalate it to our compatibility team for further analysis. You can also reach to the plugin's author to join our Go Global program
Please, ask the plugin author to join our Go Global Program in order to make the plugin fully compatible with WPML.
https://wpml.org/documentation/theme-compatibility/go-global-program/

Let me know what do you think.

Best regards,
Jamal
WPML Support

May 2, 2019 at 4:32 am #3721681

susanS-5

Hi Jamal,

Test server creation is WPML ready and allows me to install the plugin and reproduce the issue?
Please advise, thanks.

Regards,
Susan

May 2, 2019 at 9:14 am #3723147

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Susan,

Please use this link to connect to the test server, if you need FTP access to upload the plugin, go to Sandbox menu.
hidden link

Best regards,
Jamal

May 3, 2019 at 6:34 am #3731159

susanS-5

Hi Jamal,

I have replicated the issue at the test server, as per enclosed screenshot:

1. When I switch the site language to Chinese.
2. I will not be able to logout.

Please assist, thank you.

May 3, 2019 at 9:35 am #3732659

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your efforts. I think this is another issue.

If I understood well, the original issue of this ticket is users applying the secondary language will log out with 404 error.

I translated a page and a post and I can access both without being logged out.

Would you please explain the issue in a way like:
1. I go to xxx
2. I do xxx
3. I expect to have xxx
4. Instead, I get xxx

So I can know what settings you used in WPML and WPS Hide Login.

Best regards,
Jamal

May 6, 2019 at 3:29 am #3744751

susanS-5

Hi Jamal,

Below are the scenarios:

1. I go to wp-admin dashboard.
2. I do the language switch from English and Chinese at the top bar; then logout.
3. I expect to get redirected to the login page.
4. Instead, I get redirected to the home page (which indicates this is an unsuccessful logout).

Please assist, thanks.

May 6, 2019 at 10:36 am #3747099

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Thank you,

I escalated this ticket to our compatibility team. Please note that this will be done according to the team priorities. I will come back to you as soon as they provide feedback.

You may also ask the plugin developer to join our Go Global program in order to make the plugin fully compatible with WPML.
https://wpml.org/documentation/theme-compatibility/go-global-program/

Best regards,
Jamal

May 8, 2019 at 1:41 pm #3767297

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Our compatibility team has found that the logout URL is not properly built using language in URL parameters.
The issue does not happen when using languages in folders.
https://wpml.org/documentation/getting-started-guide/language-setup/#language-url-format

Is switching to languages in folders is a suitable workaround for you?

Best regards,
Jamal

May 8, 2019 at 11:26 pm #3771519

susanS-5

Hi Jamal,

Thanks for the prompt update!

In my case, switching the languages into folders will generate some issues. Is there a workaround in functions.php that I can rename the login slug (without having the plugin installed)?

Please advise, thanks.

Regards,
Susan

May 9, 2019 at 8:54 am #3774333

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hi Susan,

I'll escalate your feedback to our compatibility team and see if they can find a solution.

In the meanwhile, I don't think there is an easy way through functions.php to have this functionality. You can make a redirect in the .htaccess file. See this question on StackExchange
https://wordpress.stackexchange.com/questions/256366/how-to-edit-htaccess-to-change-sites-login-url

You can also use a compatible plugin, like WP Hide & Security Enhancer. Consider that I never use it before and that you should test it to check if it suits you.
https://wpml.org/plugin/wp-hide-security-enhancer/
https://wordpress.org/plugins/wp-hide-security-enhancer/

Or you can manually do it, but it would be overwritten after each WordPress plugin, here an article that explains how:
hidden link

Best regards,
Jamal

May 9, 2019 at 1:15 pm #3776381

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

We can keep the language in URL format, but we will need to patch the plugin. Please note that you will lose this once you update the plugin to a new version.
Please change file /classes/plugin.php inside the plugin folder and change(or comment) line 151 with the following.

return ( get_option('home') . '/' . $this->new_login_slug() );

You can check the sandbox I commented the line 151 and added this code in line 152.

Let me know if this solution is working on your website.

Best regards,
Jamal

May 10, 2019 at 10:52 am #3783431

susanS-5

Hi Jamal,

Thank you so much for the effort!!!

I can logout from the dashboard or web pages of secondary language but I can't login (with the correct credentials). After reverting the code, I can login.

Any further solution?

Please advise, thanks.

Regards,
Susan

May 10, 2019 at 12:06 pm #3784015

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

I confirm this issue, I was not able to login to the sandbox with username/password. I am escalating again this information to our compatibility team. I'll be back to you as soon as possible.

Best regards,
Jamal

May 13, 2019 at 9:19 am #3796411

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Our compatibility team has produced a new fix for the issue, but it needs that site_url and home_url be the same. The patch is changing or commenting line 151 of the same file "/classes/plugin.php" with the following.

return $this->user_trailingslashit( site_url( '/', $scheme ) . $this->new_login_slug() );

I tested the patch in the test server and it seems to work. Can you confirm that this is working on your server?
Looking forward to your reply.

Best regards,
Jamal