PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 All 139 releases
← All changes | includes/Core/Fallback/FormFallback.php +36 -0 V3.0.2 → V3.3.2 View file →
@@ -5,8 +5,9 @@
5 5 use BitCode\BitForm\Admin\Form\AdminFormHandler;
6 6 use BitCode\BitForm\Core\Database\DB;
7 7 use BitCode\BitForm\Core\Database\FormModel;
8 8 use BitCode\BitForm\Core\Form\FormHandler;
9 +use BitCode\BitForm\Core\Form\FormManager;
9 10 use BitCode\BitForm\Core\Migration\MigrateForms;
10 11 use BitCode\BitForm\Core\Migration\MigrationHelper;
11 12
12 13 final class FormFallback
@@ -21,8 +22,43 @@
21 22 [
22 23 'status' => 1
23 24 ]
24 25 );
26 + }
27 +
28 + /**
29 + * Name/Address children renamed with their parent before 3.3.2 kept the old prefix, so their
30 + * inputs posted away from the parent and its entry value saved empty. Safe to re-run: only
31 + * forms whose names actually change are written.
32 + *
33 + * @return void
34 + */
35 + public function syncCompositeChildNames()
36 + {
37 + $formModel = new FormModel();
38 + $forms = $formModel->get(
39 + ['id', 'form_content'],
40 + [
41 + 'form_content' => ['operator' => 'LIKE', 'value' => '%"childFields"%'],
42 + ]
43 + );
44 + if (is_wp_error($forms) || !is_array($forms)) {
45 + return;
46 + }
47 + foreach ($forms as $form) {
48 + $formContent = json_decode($form->form_content ?? '');
49 + if (!is_object($formContent) || !isset($formContent->fields)) {
50 + continue;
51 + }
52 + if (!FormManager::syncCompositeChildNames($formContent->fields)) {
53 + continue;
54 + }
55 + $encoded = wp_json_encode($formContent);
56 + if (!is_string($encoded)) {
57 + continue;
58 + }
59 + $formModel->update(['form_content' => $encoded], ['id' => $form->id]);
60 + }
25 61 }
26 62
27 63 public function v1formMigragion()
28 64 {