- สถานะ
- แก้ไขแล้วโดยผู้พัฒนา
- รายงานสำหรับ
- WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- BuddyBoss Platform
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
มีความไม่สอดคล้องกันในการเรียงลำดับตามตัวอักษรของฟิลด์อนุกรมวิธานที่แปลแล้วบนหน้าโปรไฟล์ BuddyBoss ในขณะที่ฟิลด์ภาษาเริ่มต้นได้รับการเรียงลำดับอย่างถูกต้อง แต่ฟิลด์ที่แปลแล้วไม่ได้คงลำดับนี้ไว้
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าคุณได้สำรองข้อมูลไซต์ทั้งหมดของคุณก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/buddyboss-platform/bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php
- ใน
BP_XProfile_Field_Type_Selectbox::edit_field_options_html()ให้แทนที่บรรทัดต่อไปนี้:echo $html;
- ด้วย:
// WPML Workaround for compsupp-7514 if ( class_exists('Sitepress') && apply_filters('wpml_default_language', NULL ) != apply_filters( 'wpml_current_language', NULL ) ) { // Match all options preg_match_all('/<option(.*?)>(.*?)<\/option>/s', $html, $matches, PREG_SET_ORDER); // Extract the options into an array $optionsArray = []; foreach ($matches as $match) { $optionsArray[] = [ 'full' => $match[0], 'attributes' => $match[1], 'text' => $match[2], ]; } // Sort the array by the 'text' element usort($optionsArray, function($a, $b) { return strcmp($a['text'], $b['text']); }); // Rebuild the HTML string $sortedHtml = ''; foreach ($optionsArray as $option) { $sortedHtml .= sprintf('<option%s>%s</option>', $option['attributes'], $option['text']); } $html = $sortedHtml; } echo $html;