Skip Navigation

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 8 replies, has 2 voices.

Last updated by Dražen Duvnjak 3 years, 8 months ago.

Assisted by: Dražen Duvnjak.

Author Posts
July 27, 2020 at 10:58 am #6682493

gb-2

ultimate member redirection URL to translated Language

July 27, 2020 at 12:15 pm #6683065

gb-2

Hello, I've receive the ticket email with my chat.
I've to provide you the site Duplicator packages to create staging server.

What can I do ?

Thank you so much

July 28, 2020 at 8:58 am #6689653

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

sorry to keep you waiting.

I have tried to reproduce the issue on the sandbox, and I think I managed to get the same issue on a clean install.

Can you please check and confirm this is the same issue you are having on your live website.

Sandbox admin auto-login:
- hidden link

User is always redirected to the default language URL instead of translated, explained issue:

When a subscriber tries to login via the Italian login page (2nd language):
- hidden link,

he should be redirected to Italian page (2nd language) as translated in WPML>String Translation:
- hidden link

but instead, he is redirected to default language page:
- hidden link

Please check the sandbox and let me know.

Thank you,
Drazen

July 29, 2020 at 7:23 am #6697681

gb-2

Hello Dražen,
thank you for your support.
Exactly, that's my situation.

What can I do?

Thank you.

July 29, 2020 at 9:27 am #6698493

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thank you for getting back.

1) I have checked on this issue, and it seems this is known issue with Ultimate Member plugin which is not yet on our compatible plugins lists:

- https://wpml.org/documentation/plugins-compatibility/

We have tried inviting the author to our Go global program, so they can work with our developers help to make this plugin compatible with WPML:

- https://wpml.org/documentation/theme-compatibility/go-global-program/

Can you please contact the author and advise to join our compatible program, it might help speed up the process.

Ticket with the same issue:

- https://wpml.org/it/forums/topic/auto-register-strings-for-translation-2/page/2/#post-5679979

2) In the meantime, you can use the next workaround code. I am providing you with a working code for subscriber role and login_redirect_url.

Take into account that you will need to add this code for every URL and role that you want to redirect. Also, you will need to change the domain and name of the string accordingly. You can find that in WPML > ST.

Here you have an explanation of the hook used:
https://wpml.org/wpml-hook/wpml_translate_single_string/

Please add this to your child theme functions.php:

add_filter('um_login_redirect_url', "translate_login_redirect_url", 10, 2);

function translate_login_redirect_url($redirect_url, $id) {
	$redirect_url = apply_filters( "wpml_translate_single_string", $redirect_url, "admin_texts_um_role_subscriber_meta", "[um_role_subscriber_meta]_um_login_redirect_url");
	return $redirect_url;
};

Let me know how it goes and if there is anything else I can do for you.

Thanks,
Drazen

July 30, 2020 at 8:21 am #6705695

gb-2

Hello Dražen,
thank you so much, now the redirection works!

But I've another problem 😀
Now the link "hidden link" not works in all language, it redirect to "hidden link"

Thank you!

July 30, 2020 at 12:29 pm #6708293

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Great! 🙂

Glad to hear your issue is now solved.

As your link says, the page is trashed and can not be accessed. Restore your page from Trash and it should work normally.

Info: https://wordpress.org/support/topic/trashed-urls/

Regards,
Drazen

July 31, 2020 at 10:40 am #6714699

gb-2

Thank you Drazen for your support,
the problem is that the page is not trashed, because is the login page.
The user to logout click on a button created by me with this href "hidden link" customized for all language.
After write your code in function.php the link doesn't worked anymore.

Thank you.

July 31, 2020 at 2:04 pm #6716163

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Thanks for the reply.

You should set up Ultimate member plugin as recommended. Set up all pages and translate them, the same goes for the Logout page.

They need to exist and be published if you are planning to use them. You can easily add this Logout page to your menu/button, like any other page.

Then set up redirect URL for Subscriber role in Ultimate member settings as you do for other pages.

Translate this redirect URL to other languages by adjusting the shared redirect code.

Please check the image attached.

I hope I was helpful, let me know how it goes.

Thanks and regards,
Drazen

Screenshot_2.jpg
Screenshot_1.jpg
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.