- الحالة
- محلولة
- أُبلغ عنها لـ
- WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
- تم حلها في
- BuddyPress Multilingual 1.8.0
- الإضافة/القالب ذو الصلة
- BuddyPress
نظرة عامة على المشكلة
تتيح لك إضافة BuddyPress إنشاء حقول ملف شخصي جديدة والتي يمكنك ترجمتها باستخدام إضافة الربط BuddyPress Multilingual من WPML. ومع ذلك، حتى لو ظهرت هذه الحقول على أنها مترجمة في WPML → ترجمة النصوص، فإن تلك الترجمات لا تظهر في الواجهة الأمامية.
حل بديل مؤقت
يرجى التأكد من إنشاء نسخة احتياطية كاملة لموقعك قبل المتابعة.
- أضف الكود التالي إلى ملف 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; } - زُر صفحة الملف الشخصي في الواجهة الأمامية. سيؤدي هذا إلى تسجيل الحقول للترجمة.
- اذهب إلى WPML → ترجمة النصوص وترجم قيم الحقول ضمن النطاق BuddyPress Profile Fields.
- عُد إلى صفحة الملف الشخصي في الواجهة الأمامية. يجب أن تكون الحقول الآن مترجمة.