WPML
Trạng thái
Đã giải quyết
Được báo cáo cho
WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
Đã giải quyết trong
BuddyPress Multilingual 1.8.0
Plugin/giao diện liên quan
BuddyPress

Tổng quan về lỗi

Plugin BuddyPress cho phép bạn tạo các trường hồ sơ mới mà bạn có thể dịch bằng plugin kết nối BuddyPress Multilingual của WPML. Tuy nhiên, ngay cả khi các trường đó hiển thị là đã dịch trong WPMLDịch chuỗi, các bản dịch đó vẫn không hiển thị trên giao diện người dùng.

Giải pháp tạm thời

Vui lòng đảm bảo tạo một bản sao lưu đầy đủ cho trang web của bạn trước khi tiếp tục.

  1. Thêm mã sau vào tệp functions.php.
     //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. Truy cập trang hồ sơ trên giao diện người dùng. Điều này sẽ đăng ký các trường để dịch.
  3. Đi tới WPMLDịch chuỗi và dịch các giá trị trường trong miền BuddyPress Profile Fields.
  4. Quay lại trang hồ sơ trên giao diện người dùng. Các trường lúc này sẽ được dịch.

Tất cả các lỗi đã ghi nhận →