fixing user language when sending form
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
35bef9e013
commit
2aa985760a
|
|
@ -65,7 +65,24 @@ function homegrade_paper_publications_form_limit_countries($form)
|
||||||
return array("Belgique" => __("Belgique", "homegrade_theme--texte-fonctionnel"));
|
return array("Belgique" => __("Belgique", "homegrade_theme--texte-fonctionnel"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add user language to the form submission
|
||||||
|
add_filter('gform_pre_submission_18', 'set_hidden_field_value');
|
||||||
|
function set_hidden_field_value($form)
|
||||||
|
{
|
||||||
|
// ID du champ caché
|
||||||
|
$user_language_field = 27;
|
||||||
|
$current_language = apply_filters('wpml_current_language', NULL);
|
||||||
|
|
||||||
|
|
||||||
|
// Remplir le champ caché avec la valeur
|
||||||
|
foreach ($form['fields'] as &$field) {
|
||||||
|
if ($field->id == $user_language_field) {
|
||||||
|
$_POST["input_{$field->id}"] = $current_language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user