콘텐츠로 건너뛰기 사이드바로 건너뛰기

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When using Ultimate Membership Pro with WPML, you might experience an issue where checkbox values used in member profiles and directory filters are not translatable. and prevents translated labels from appearing correctly on translated directory pages or forms.

Workaround

Please make sure you have a full backup of your site before proceeding.

1- Delete Incorrect Translations

  • Go to WPML > String Translation
  • Filter by Translation Complete
  • Search for strings under the field name [ihc_user_fields]
  • Select all these strings and delete them – they are value strings and should not be translated.

2- Modify Frontend Filter Template

  • Open: wp-content/plugins/indeed-membership-pro/public/views/listing_users-filter.php
  • Look for: Line 167 under the case ‘checkbox’
  • Replace:

    
    <?php
    foreach ($field['values'] as $v){
        if (is_array($get_value)){
            $checked = (in_array($v, $get_value)) ? 'checked' : '';
        } else {
            $checked = ($v==$get_value) ? 'checked' : '';
        }
        ?>
        <div class="iump-form-checkbox">
            <input type="checkbox" name="<?php echo esc_attr($field['name']);?>[]" value="<?php echo esc_attr(ihc_correct_text($v));?>" <?php echo esc_attr($checked);?> />
            <?php echo esc_html(ihc_correct_text($v));?>
        </div>
        <?php
    }
    ?>
    
    

    With:

    
    
    <?php
    foreach ($field['values'] as $v){
        if (is_array($get_value)){
            $checked = (in_array($v, $get_value)) ? 'checked' : '';
        } else {
            $checked = ($v==$get_value) ? 'checked' : '';
        }
    
        // WPML: Separate value and label
        $wpml_original_value = ihc_correct_text($v);
        $wpml_string_name = 'checkbox_option_' . $field['name']; 
        do_action( 'wpml_register_single_string', 'ihc', $wpml_string_name . '_' . sanitize_title($v), $wpml_original_value );
        $wpml_translated_label = apply_filters( 'wpml_translate_single_string', $wpml_original_value, 'ihc', $wpml_string_name . '_' . sanitize_title($v) );
    ?>
        <div class="iump-form-checkbox">
            <input type="checkbox" name="<?php echo esc_attr($field['name']);?>[]" value="<?php echo esc_attr(ihc_correct_text($v));?>" <?php echo esc_attr($checked);?> />
            <?php echo esc_html($wpml_translated_label); ?>
        </div>
    <?php
    }
    ?>
    

3- Fix Registration Form Checkbox Labels

  • Open: wp-content/plugins/indeed-membership-pro/classes/IndeedForms.php
  • Look for: The checkbox function (around line 129)
  • Replace:

    
    $output .= ihc_correct_text( $v );
    

    With:

    
    $output .= __( ihc_correct_text( $v ), 'ihc' );</ul>
    

    4- Trigger String Registration

    • Visit the directory page on the frontend to load new strings.
    • Go to WPML > String Translation and translate only the newly registered strings under the “ihc” domain (named like checkbox_option_name).

답글 남기기

주제에 집중하고 다른 사람을 존중해 주세요. 이 게시물과 관련 없는 문제에 도움이 필요하면 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하세요.

다음 태그를 사용할 수 있습니다:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>