Url email notification other language
-
I have two languages, FR is the default language and EN for the English page.
I have a problem with the urls of the notification emails, to activate the account, for example, the link is like this:
the url href=”{account_activation_link}”>Activate your account<What should I do to make this link work properly so that it points to /en/? when the english user clck on the link and redirects it on the /en/ part
-
Hello @scoufy
Can you please mention which plugin are you using to make your website multilingual? There is a filter to change the account activation link URL, you can use it to filter the URL.
apply_filters( 'um_activate_url', function( $url ){ // apply url filter here return $url; } );
What you need to add to change the URL can be different based on what plugin you are using.
Hello @aswingiri
I use Polylang.
For UM version 2.2.5 because the last version did not work (there is a topic on this subject.What should I do with your code, I don’t quite understand?
Hello @scoufy
I am sorry, I made some typos on the codes provided above, here is the new code snippet.
add_filter( 'um_activate_url', function( $url ){ if(function_exists('pll_current_language')){ $lang = pll_current_language( 'locale' ); $url = apply_filters( 'pll_translation_url',$url,$lang ); } return $url; });
You can install and activate this plugin and add a new snippet from wp-admin area. You can add any title and just paste these codes into the Code input box. Once pasted, you can click on “save and activate” the button.
Thank you @aswingiri
I installed the plugin and activated,
I added your code in “Code Snippets”, I left the default settings and the box “Run the snippet everywhere” checked by default.When the person creates an account he receives the email (in spam but that’s another subject), the email is in EN (which is the second language), when he clicks on “ACTIVATE YOUR ACCOUNT” (the link is like this: https://xxxxxxxxxxxxx.net/?act=activate_via_email&hash=iTxy7Ks4DTWat&user_id=17, we can see that it will not direct to the EN language because on the link there is no https:/ /xxxxxxxxxxxx.net/EN/?act=activate_via_email&hash…., it returns to the FR language (default language), therefore the person receives the welcome email but in FR
It’s tested on Firefox configured in EN and the link is redirected to EN with @missveronica solution
I also have some buttons again not working like the gear on the profile, I have to refresh the page for it to work from time to time, same for the “account” page, the list on the left is showing good but nothing in the right side with the choice of options, same for change password, privacy and delete account) even when you click on it…
It’s a shame that your plugin doesn’t work directly because I’ve been on it for 3 weeks and I’m having a lot of difficulty trying to get it to work (without benefiting from the latest version…). Difficult for me to project myself for a possible purchase in order to benefit from other functionalities later..) or if I have to look for another plugin..
It’s tested on Firefox configured in EN and the link is redirected to EN with @missveronica solution
Which version are you testing?
Have you seen my latest update where you don’t need the
../en/..
pages if you use the new shortcode?https://github.com/MissVeronica/UM-Backend-Local-Language
- This reply was modified 2 years, 7 months ago by missveronica.
@missveronicatv,
No I hadn’t seen (I don’t know how to receive an alert for GitHub..).I replaced the file with the latest version and redid the tests (several)
– when I register in the EN language, I have the message:
“Thank you for your registration. Before you can log in you must activate your account by clicking on the activation link that we have just sent you by e-mail. ”
in FR (but the page is in EN!), I don’t know where this variable is in the .po file– The account creation email for the admin is in EN
– The activation email (of the subscriber) is in EN*
– The “welcome” active account confirmation email (of the subscriber) is in FR!*When I click on the url included in the email to activate the account, I am directed to the login page in FR (and not EN)
/login/?updated=account_active
I then have to reselect EN manually on the language selector to return to EN..If I click again in the email on activate my account the message which states that the link has expired or has already been used is also in FR (if I add /en/ to the url it is in English..)
/en/?act=activate_via_email&hash=QP0afvhOdyRwhKYdcyJgZwQeBRsdPiWV&user_id=18Shortcode used [um_locale_language_setup en_GB 2057 fr_FR 1061] (copied as it is there on all EN pages related to UM), is this correct?
I activated did a test (negative) and deactivated the code previously proposed in Snippets.. negative result.
The language is well detected, the problem is the activation links included in the email which does not redirect to the member’s language…
*When I click on the url included in the email to activate the account, I am directed to the login page in FR (and not EN)
/login/?updated=account_active
I then have to reselect EN manually on the language selector to return to EN..[um_locale_language_setup en_GB X fr_FR Y]
Where X is your GB Login page form ID
Where Y is your FR Login page form IDAdd the shortcode to the page where you have the FR login page now and replace current UM Shortcode.
Test this setting for the Login Page if it’s OK and you get the right language with different browser language settings on the Page.
Shortcode used
[um_locale_language_setup en_GB 2057 fr_FR 1061]
(copied as it is there on all EN pages related to UM), is this correct?No, this Shortcode should replace the UM Shortcode now displaying your FR profile page if the Forms 2057 and 1061 are your Profile Forms.
Same procedure for Member Directory Forms
By doing these replacements you can obsolete the
/EN/
directoryIt still doesn’t work ??
I removed the shortcodes that were installed and replaced the new ones on the 3 pages below with the form ids:
login
[um_locale_language_setup en_GB 8041 fr_FR 8018]profile
[um_locale_language_setup en_GB 8133 fr_FR 8019]registration
[um_locale_language_setup en_GB 8040 fr_FR 8017]Everything is fine in English. the big problem is activation via email, once clicked on “activate my account” the page opens on FR mondomaine.net/login/?updated=account_active and not on EN
If I try to add the EN in the url, like that mondomaine.net/en/login/?updated=account_active it is redirected to mondomaine.net/login/?updated=account_active and then everything is in FRFirefox browser configured in EN and by default for the test…
Do you want access to test, I am ready to give them to you if it can be useful to you?
Now you can try this script, where there are updates to the decoding of the Browser preferred language. My test with two different languages for the email activation link to the UM Login form works OK.
You must also add the
en_US
language to your shortcodes and you can set the same form_id for US English as you have for GB English.[um_locale_language_setup en_GB 8041 en_US 8041 fr_FR 8018]
I replaced your script for
I placed the shortcodes on the EN and FR pages:login
[um_locale_language_setup en_GB 8041 en_US 8041 fr_FR 8018]profile
[um_locale_language_setup en_GB 8133 en_US 8133 fr_FR 8019]registration
[um_locale_language_setup en_GB 8040 en_US 8040 fr_FR 8017]members
[um_locale_language_setup en_GB 8119 en_US 8119 fr_FR 8020]It still doesn’t work, once I click on the email (received in EN, that’s good), the activation url returns to FR
I just disabled in Polylang the “Detect browser language” feature and the browser language is no longer picked up automatically, I take it it’s not the script that does it. (But it’s not that important since Polylang does it).
I made several tests by deactivating for example my cache extension, I empty the cookies at each test, empty the browser cache,…
I’m really sorry and discouraged because you and I spend a lot of time on something that should work the first time. Fortunately I’m a patient person and I haven’t yet looked for another plugin but I won’t be able to spend all my time testing because this new site should be online soon…
[Edit]
For language detection I think it’s not really a problem because it’s detected by polylang.The problem is this url in the activation email which does not refer to the page /en/login-2/?updated=account_active but to /login/?updated=account_active
Once on the correct language after activation the user would stay in EN..
I placed the shortcodes on the EN and FR pages:
The shortcode only on the FR pages and remove all EN pages.
The shortcode will take care of the language on the FR pages.The problem is this url in the activation email which does not refer to the page /en/login-2/?updated=account_active but to /login/?updated=account_active
Forget about links with
/en/login-2/
if you have the shortcode on the/login/
page the shortcode will take care of the language.All login links should go to the
/login/
page and also set up this page in UM General settings as the login page.- This reply was modified 2 years, 7 months ago by missveronica.
- This reply was modified 2 years, 7 months ago by missveronica.
The shortcode only on FR pages and remove all EN pages.
The shortcode will take care of the language on the FR pages.Sorry for this additional question before modifying everything again, but what do you mean by “delete all EN pages” I have to delete your shortcode and put the form shortcode back on EN (register, login,..)? Or delete these EN pages?
All login links must go to the /login/ page and also configure this page in the UM general settings as the login page.
How will the /login/ page be in EN language because by default it is in FR?
To summarize what should I do with the login, register, password-reset, profile pages for FR and EN?
Sorry again but it’s not easy with the translations (which I translate with google translate) ??
Hello @missveronica ,
Could you explain to me so that I can move forward in my development please ??
How will the /login/ page be in EN language because by default it is in FR?
Make a simple test on your FR login page with the shortcode at the Login page.
Try to do a login with a Browser using the GB language and use the FR page address.
@missveronica
Really a big thank you for trying to help me, but maybe we can’t understand each other?I have no problem with the translation for what is displayed on the login pages, registration, … Everything is well displayed in the language that is detected by Polylang.
If I disable language detection in Polylang, first problem (logical), the page remains in French on my browser configured in English (I will avoid EN and FR because Google translation tells me the opposite lol). The login form is in English, except for a few options like “remember me”, “forgot password”.
If I select the English language (language selector), everything is fine in English (again it makes sense).
It’s the same for the registration page…I leave you the url of the site (tell me when you have recovered the address so that I can remove it from here)
https://**********.net
You may understand my problem better, do not hesitate to create an account to understand and see in which language you will receive the emails and the problem with the activation… (if necessary I will give you temporary admin access)
- The topic ‘Url email notification other language’ is closed to new replies.