PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.16.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.16.2
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 2.10.1 2.10.2 All 137 releases
← All changes | includes/Core/Fallback/Report.php +41 -3 2.02.16.2 View file →
@@ -5,15 +5,23 @@
5 5 use BitCode\BitForm\Core\Database\FormModel;
6 6 use BitCode\BitForm\Core\Database\ReportsModel;
7 7 use BitCode\BitForm\Core\Util\IpTool;
8 8
9 -class Report {
10 - public function report() {
9 +class Report
10 +{
11 + public function report()
12 + {
11 13 $reportMdl = new ReportsModel();
12 14 global $wpdb;
13 15 $tablename = $wpdb->prefix . 'bitforms_reports';
14 16
15 - $latestIds = $wpdb->get_results("SELECT MAX(`id`) as latest_id FROM $tablename GROUP BY `context`");
17 + // $latestIds = $wpdb->get_results("SELECT MAX(`id`) as latest_id FROM $tablename GROUP BY `context`");
18 + $wpdb->query(
19 + $wpdb->prepare(
20 + "SELECT MAX(`id`) as latest_id FROM $tablename GROUP BY `context`"
21 + )
22 + );
23 + $latestIds = $wpdb->last_result;
16 24
17 25 $notDeletedIds = array_column($latestIds, 'latest_id');
18 26
19 27 if (!is_wp_error($latestIds) && count($notDeletedIds) > 0) {
@@ -62,8 +70,38 @@
62 70 'updated_at' => $user_details['time'],
63 71 ];
64 72
65 73 $reportMdl->insert($defaultReport);
74 + }
75 + }
76 + }
77 +
78 + public function addHiddenColumns()
79 + {
80 + $reportMdl = new ReportsModel();
81 + $reports = $reportMdl->get(
82 + [
83 + 'id',
84 + 'details',
85 + ],
86 + [
87 + 'category' => 'form',
88 + 'type' => 'table',
89 + ]
90 + );
91 +
92 + foreach ($reports as $report) {
93 + $reportDetails = json_decode($report->details);
94 + if (is_object($reportDetails) && (!property_exists($reportDetails, 'hiddenColumns') || empty($reportDetails->hiddenColumns))) {
95 + $reportDetails->hiddenColumns = ['__user_id', '__user_ip', '__referer', '__user_device', '__created_at', '__updated_at'];
96 + $reportMdl->update(
97 + [
98 + 'details' => wp_json_encode($reportDetails),
99 + ],
100 + [
101 + 'id' => $report->id,
102 + ]
103 + );
66 104 }
67 105 }
68 106 }
69 107 }