WPML
סטטוס
ממתין למפתח
סוג
באג
תוסף/ערכת עיצוב קשורים
WP User Manager
תגיות נושא
Compatibility

סקירת התקלה

בעת שימוש ב־WP User Manager להוספת שדות מותאמים אישית לפרופילים, ייתכן שתיתקל בבעיה הבאה: אפשרויות מתוך בחירה מרובה של שדות מותאמים אישית לא ניתנות לתרגום בתרגום מחרוזות של WPML.

פתרון עוקף

אנא, ודא שיש לך גיבוי מלא של האתר לפני שתמשיך.

1. תיקון תוסף השילוב (WPUM-WPML)


  • פתח את הקובץ …/wp-content/plugins/wpum-wpml/includes/class-wpum-wpml-fields.php.

  • חפש את שורה 20.

  • החלף את:
    add_action( 'update_wpum_field_meta', array( $this, 'update_meta_strings' ), 10, 4 );
            


  • ב:
    add_action( 'updated_wpum_field_meta', array( $this, 'update_meta_strings' ), 10, 4 );
            

  • לאחר מכן, עבור אל משתמשים > שדות מותאמים אישית, ערוך לפחות אחת מאפשרויות שדה הבחירה המרובה, ואז נווט אל WPML > תרגום מחרוזות כדי לתרגם את הערכים.

2. תיקון הפלט בצד הלקוח ב־WP User Manager


  • פתח את הקובץ …/wp-content/plugins/wp-user-manager/includes/fields/types/class-wpum-field-multiselect.php.

  • חפש את שורה 56.

  • החלף את כל הפונקציה get_formatted_output() ב:
    public function get_formatted_output( $field, $value ) {
    
        $stored_field_options = $field->get_meta( 'dropdown_options' );
        $stored_options       = array();
        $stored_index         = array();
    
        // Keep the plugin's own guard.
        if ( ! is_array( $stored_field_options ) ) {
            return '';
        }
    
        foreach ( $stored_field_options as $key => $stored_option ) {
            $val                    = isset( $stored_option['value'] ) ? $stored_option['value'] : $key;
            $lbl                    = isset( $stored_option['label'] ) ? $stored_option['label'] : '';
            $stored_options[ $val ] = $lbl;
            $stored_index[ $val ]   = $key;
        }
    
        $values = array();
    
        // Keep the plugin's (array) cast.
        foreach ( (array) $value as $user_stored_value ) {
            if ( ! isset( $stored_options[ $user_stored_value ] ) ) {
                continue;
            }
    
            $label = $stored_options[ $user_stored_value ];
            $index = isset( $stored_index[ $user_stored_value ] ) ? $stored_index[ $user_stored_value ] : 0;
    
            $translated_label = apply_filters(
                'wpml_translate_single_string',
                $label,
                'wpum-fields-wpum-field-' . $field->get_ID(),
                'wpum-field-dropdown_options_' . $index
            );
    
            $values[] = $translated_label;
        }
    
        return implode( ', ', $values );
    }
            

כל התקלות הידועות