Resolved
Overview of the issue
Using the language switcher to navigate to the secondary language(s) page does not work on the user’s page. Furthermore, the links on the left sidebar does not direct to the right language.
Workaround
To resolve this issue add the snippet below to the functions.php file found in your theme’s folder.

//Code for fixing the Language switcher add_filter( 'icl_ls_languages', 'bbpress_user_ls_fix' ); function bbpress_user_ls_fix( $languages ) { global $wp_query, $sitepress_settings; if ($sitepress_settings['language_negotiation_type'] != 3 ) { if ( bbp_is_single_user_profile() ) { foreach ( $languages as $code => $language ) { $home = trailingslashit( get_home_url() ); do_action( 'wpml_switch_language', $code ); $lang_url = trailingslashit( apply_filters( 'wpml_home_url', $home ) ); $url = str_replace( $home, $lang_url, bbp_get_user_profile_url() ); $languages[ $code ]['url'] = $url; } do_action( 'wpml_switch_language', ICL_LANGUAGE_CODE ); } } else { if ( bbp_is_single_user_profile() ) { $current_language = apply_filters( 'wpml_current_language', NULL ); $default_language = $sitepress_settings["default_language"]; foreach ( $languages as $code => $language ) { if ( $code != $default_language ) { $url = bbp_get_user_profile_url(); $parsed = parse_url($url); unset($parsed["query"]); $parsed["query"] = "lang=" . $code; $url = http_build_url($parsed); $languages[ $code ]['url'] = $url; } elseif ( $code == $current_language ) { $home = get_home_url() ; do_action( 'wpml_switch_language', $code ); $lang_url = apply_filters( 'wpml_home_url', $home ) ; $url = str_replace( $home, $lang_url, bbp_get_user_profile_url() ); $languages[ $code ]['url'] = $url; } else { $url = bbp_get_user_profile_url(); $parsed = parse_url($url); unset($parsed["query"]); $url = http_build_url($parsed); $languages[ $code ]['url'] = $url; } } do_action( 'wpml_switch_language', ICL_LANGUAGE_CODE ); } } return $languages; } //Code for redirecting the sidebar links to the right language add_filter( 'bbp_get_user_topics_created_url', 'bbpress_user_urls_fix' ); add_filter( 'bbp_get_user_replies_created_url', 'bbpress_user_urls_fix' ); add_filter( 'bbp_get_user_engagements_url', 'bbpress_user_urls_fix' ); add_filter( 'bbp_get_favorites_permalink', 'bbpress_user_urls_fix' ); add_filter( 'bbp_get_subscriptions_permalink', 'bbpress_user_urls_fix' ); add_filter( 'bbp_get_user_edit_profile_url', 'bbpress_user_urls_fix' ); function bbpress_user_urls_fix( $url ) { global $sitepress_settings; if ($sitepress_settings['language_negotiation_type'] == 3 ) { $default_language = $sitepress_settings["default_language"]; $current_language = apply_filters( 'wpml_current_language', null ); $length = strlen ("?lang=" . $current_language); $parsed = parse_url( $url ); if ( $current_language == $default_language ) { unset( $parsed["query"] ); } else { $parsed["path"] .= substr( $parsed["query"], $length ); $parsed["query"] = "lang=" . $current_language; } $url = http_build_url( $parsed ); } return $url; }
yes, this is helpful, thank you for sharing
thank you for your code, it’s really helpful.
Glad to know that it works!
thank you for sharing. The code i helpful.
Thanks
Cool! thank you for sharing.Its help me,TKS
I’ve tried it after the latest update and adding this code to functions.php just stops the page from loading.
Hi,
Could you please open a support ticket for this? Our support team will be happy to help you in resolving the issue.
We’ve found the problem. We were calling a wrong function to display the drop down menu.
I am glad you managed to sort it out 🙂
yes, thank you for sharing,this is helpful,
Thanks for your comment! I am glad to know that the workaround works for you.
Thanks for sharing, I was confused about this for a while
You are most welcome!
Thanks for sharing!
use bbPress for site gutenkit, have the same problem but use this solution still now working.
If you are still encountering the same issue after applying the fix described in this errata, please visit our support forum and open a ticket describing your issue. Our support team will be more than happy to assist you:
https://wpml.org/forums/forum/english-support/
thank you for sharing. The code is That’s what I need.
Thanks for sharing.
The article slove the Language bbpress switch problem
Thank you for sharing. It really solved my problem.
Thanks For Sharing………….
thank you for sharing. The code is That’s what I need.