Open
Reported for: WPForms Multilingual 0.4.1
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:
1234567
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:
12345678
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
] );
}
}