Pular a navegação

Open

Reported for: BuddyPress Multilingual 1.7.0

Overview of the issue

The BuddyPress plugin allows you to create new profile fields which you can translate using WPML’s BuddyPress Multilingual glue plugin. However, even if those fields appear as translated in WPMLString Translation, those translations are not visible in the front-end.

Workaround

Please, be sure of making a full backup of your site before proceeding.

  1. 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;
    } 
  2. Visit the profile page on the front-end. This will register the fields for translation.
  3. Go to WPMLString Translation and translate the field values under the BuddyPress Profile Fields domain.
  4. Go back to the profile page on front-end. The fields should now be translated.

12 Respostas para “BuddyPress - Profile fields are not translated on the frontend”

    • Hey there,
      This should be implemented in the functions.php file placed in your child theme, in that way it won’t be overwritten by a future update.
      Regards

  1. Hi Andres,

    This plugin supports 6.1.1? because the readme.txt is outdated the latest one 1.7.0 is still referring to 1.6.1 version and claim Tested up to: 5.6, so the latest one support 6.1.1?

    Thanks in advance

    • Hello there,
      Thank you for reporting this. Yes, BuddyPress Multilingual should work with WordPress +6.1.1.
      So far, we haven’t get any report related to it.
      Regards

  2. Hello,

    I used this function and strings are added in the String Translation page. But there is one error related to “Profile Fields” that is extended with “BuddyPress Xprofile Custom Field Types”.

    For custom fields that have types “Checkbox” or “Select”, if the custom field was created before the installation of WPML options are translated but they are not displayed on fronted.

    Translations of custom field title works, the error appears just with options.

    Thanks!

  3. Hi,
    does this workaround also work for the case when the profile fields in the Profile Search are not translated, but on the Profile they are?

    Best regards,

    • Hello there,
      You can try adding your custom search field in this line:
      if ($type == 'textbox' || $type == 'wp-textbox' || $type == 'wp-biography') {
      If it doesn’t work, please open a chat in our assistance channel for investigating better.
      Regards

  4. Hi!

    This fix doesn’t work if the profile field is in registration form of Buddy Boss. What happens is that if I have a Gender field. The word Gender is translated (this is the Caption of the gender select field) but the alternatives “Male” and “Female” do not get translated. They do get translated when visiting a profile on the frontend but not when registering. Is there a way to achieve this?

    With best regards,

    bb

    • Hey there,
      Thank you for your report. Could you please help us starting a chat in our assistance channel?
      In that way we will be able to replicate and investigate the issue you are mentioning.
      Thanks again!

Deixar uma Resposta

Por favor, mantenha-se no tópico e respeite os outros. Se você precisar de ajuda com problemas não relacionados a esta postagem, use nosso Fórum de suporte para iniciar um bate-papo ou enviar um tíquete.

Você pode usar estas tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>