Skip Navigation

Open

Reported for: WPForms Multilingual 0.4.1

Topic Tags: Compatibility

Overview of the issue

When using WPForms with WPML and the WPForms Multilingual addon, forms containing repeater fields display incorrect field labels (e.g., “Field ID #6_2”) in the notification email instead of the correct field names. Additionally, if a dropdown field is inside that repeater, it triggers an error, preventing the notifications from being sent.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open the …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Notifications.php file.
  • Look for line .
  • Replace:
    1
    2
    3
    4
    5
    6
    7
    foreach ( $fields as $key => &$field ) {
        $field['name'] = $formPostFields[ $key ]['label'];
        $entryFields   = Obj::propOr( [], 'fields', $entry );
        if ( array_key_exists( $key, $entryFields ) ) {
            $field['value'] = $this->getFieldValue( $field, $entry['fields'][ $key ], $formPostFields[ $key ], $translatedFields[ $key ] );
        }
    }
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    foreach ( $fields as $key => &$field ) {
        $key = strpos( $key, '_' ) !== false ? substr( $key, 0, strpos( $key, '_' ) ) : $key;
        $field['name'] = $formPostFields[ $key ]['label'];
        $entryFields   = Obj::propOr( [], 'fields', $entry );
        if ( array_key_exists( $key, $entryFields ) ) {
            $field['value'] = $this->getFieldValue( $field, $entry['fields'][ $key ], $formPostFields[ $key ], $translatedFields[ $key ] );
        }
    }

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>