- Status
- Resolved
- Type
- Bug
- Reported for
- WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
- Resolved in
- BuddyPress Multilingual 1.8.0
- Related plugin/theme
- BuddyPress
Overview of the issue
The BuddyPress plugin allows you to create new profile fields (opens in a new tab) which you can translate using WPML’s BuddyPress Multilingual glue plugin. However, even if those fields appear as translated in WPML → String Translation, those translations are not visible in the front-end.
Workaround
Please, be sure of making a full backup of your site before proceeding.
- Add the following code to the functions.php file.
//WPML Workaround wpml_compsupp6144 add_filter( 'bp_get_the_profile_field_value', 'wpml_compsupp6144_translate_buddypress_profile_fields', 10, 3 ); function wpml_compsupp6144_translate_buddypress_profile_fields( $value, $type, $id ) { if ($type == 'textbox' || $type == 'wp-textbox' || $type == 'wp-biography') { //remove html tags from value and limit it's size, so we can use it as string name $filtered_value = substr(strip_tags($value), 0, 60); //register string do_action( 'wpml_register_single_string', 'BuddyPress Profile Fields', $type.' - '.$filtered_value , $value ); //translate string $value = apply_filters('wpml_translate_single_string', $value, 'BuddyPress Profile Fields', $type.' - '.$filtered_value ); } return $value; } - Visit the profile page on the front-end. This will register the fields for translation.
- Go to WPML → String Translation and translate the field values under the BuddyPress Profile Fields domain.
- Go back to the profile page on front-end. The fields should now be translated.