account page auto redirect to home page
-
Hello
suddenly and only in mobile when click to visit UM account page its redirect me to home page ?
if I click same link but in desktop its work normall and open account pageso please advise
best regards
-
Hi @makmerghen
Could you please try clearing the UM cache and see if the language changes the selected value?
Regards,
Dear @champsupertramp I cleared it but still the same
I noted that when change the language from the form then language only changed in the backend and didn’t change in the fornt endwhat suppose to be that when user enter account page while his active language is English and and then change language to be Arabic and press update account then his language should changed to be Arabic in front end and backend but this not happened it only change in back end
note : I am using translatepress pluginso please advise
best regards-
This reply was modified 2 years, 10 months ago by
makmerghen.
Hi @makmerghen
You need the following javascript snippet to make the TranslatePress compatible with UM forms:
jQuery(window).on("load", function() { jQuery("select[data-key='locale']").on("change", function() { var trp_code_field = jQuery("input[name='trp-form-language']"); var frm = jQuery(".um.um-account form"); var lang_code = jQuery(this).val(); if (lang_code == "en_US") { trp_code_field.val(""); frm.attr("action", "/account/general/"); } else { trp_code_field.val(lang_code); frm.attr("action", "/" + lang_code + "/account/general/"); } }); });
Regards,
Dear @champsupertramp thank you for the code
I add it as java script
but unfortunatilly it is still the same
if I change language from UM form language field it only change the language of the user in back end and didn’t change it in fromtendso please advise
best regardsHi @makmerghen
See how it works on my end:
https://drive.google.com/file/d/18gXntDG-dZaAAxeZa683Oftfw-29KJXd/view?usp=sharingPlease try clearing your site and browser cache after adding the javascript code.
Regards,
Dear @champsupertramp I cleared cache but got the same result
let me tell you again my steps
1- in registration form create drop down field with meta key = locale and I add in its choices en_US and ar and the default value is en_US2- to add add language field to account page I add this snippets code
add_filter( 'um_account_tab_general_fields', 'um_120721_account_locale', 10, 2 ); function um_120721_account_locale( $args, $shortcode_args ) { $args .= ',locale'; return $args; } add_filter("um_predefined_fields_hook", "um_011122_add_language_to_account", 10, 1 ); function um_011122_add_language_to_account( $fields ){ $fields['locale'] = array( 'title' => __('Language','ultimate-member'), 'metakey' => 'locale', 'type' => 'select', 'label' => __('Language','ultimate-member'), 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => array( 'ar' => 'Arabic', 'en_US' => 'English' ) ); return $fields; }
3- add javascript snippet to make the TranslatePress compatible with UM forms:
<script type="text/javascript"> jQuery(window).on("load", function() { jQuery("select[data-key='locale']").on("change", function() { var trp_code_field = jQuery("input[name='trp-form-language']"); var frm = jQuery(".um.um-account form"); var lang_code = jQuery(this).val(); if (lang_code == "en_US") { trp_code_field.val(""); frm.attr("action", "/account/general/"); } else { trp_code_field.val(lang_code); frm.attr("action", "/" + lang_code + "/account/general/"); } }); }); </script>
so please check and advise
also please note that I made default language in translatpress as English and second as Arabic but I used option of Use a subdirectory for the default language to make Arabic the default language in front end
do think that can make issue
best regardsHi @makmerghen
We have the steps and the same settings. English is the default language in TranslatePress.
Let’s debug this issue. Please try adding the following javascript code snippet:
<script type="text/javascript"> jQuery(window).on("load", function() { jQuery("select[data-key='locale']").on("change", function() { var trp_code_field = jQuery("input[name='trp-form-language']"); var frm = jQuery(".um.um-account form"); var lang_code = jQuery(this).val(); alert( lang_code ); if (lang_code == "en_US") { trp_code_field.val(""); frm.attr("action", "/account/general/"); } else { trp_code_field.val(lang_code); frm.attr("action", "/" + lang_code + "/account/general/"); } }); }); </script>
Once the code is added, try changing the language in the Account form. It will show an alert box. Let me know if it shows the language code selected in the language dropdown.
Regards,
Regardsm
Dear @champsupertramp
sorry I missed some steps to active the java code and its work now and I can change the language in front end and in the backendbut still some issue regarding subcategory option of translatepress will investigate it and let you know the result
best regards-
This reply was modified 2 years, 10 months ago by
makmerghen.
-
This reply was modified 2 years, 10 months ago by
makmerghen.
Dear @champsupertramp
I became sure that when activate (Use a subdirectory for the default language) option to make the second language became the main language of the site then changing language field from account page will not give effect in front end
but if it is being “no” then it will give effect and language will changewhatever thank you very much for helping
I was hope that when change language from account language field then to save the selected language to the next time that this user log in again to the site even if the selected language was not the default one of the site but this can not happened
I will contact translatepress regarding this issuebest regards
Hi @makmerghen
I set the option “Use a subdirectory for the default language” to “Yes” in the TranslatePress settings and the Language option still working after submitting the Account form.
Please try updating this javascript snippet:
jQuery(window).on("load", function() { jQuery("select[data-key='locale']").on("change", function() { var trp_code_field = jQuery("input[name='trp-form-language']"); var frm = jQuery(".um.um-account form"); var lang_code = jQuery(this).val(); if (lang_code == "en_US") { trp_code_field.val(""); frm.attr("action", "/en/account/general/"); } else { trp_code_field.val(lang_code); frm.attr("action", "/" + lang_code + "/account/general/"); } }); jQuery("select[data-key='locale']").trigger("change"); });
Regards,
Dear @champsupertramp thank you very much
best regards -
This reply was modified 2 years, 10 months ago by
- The topic ‘account page auto redirect to home page’ is closed to new replies.