Version Description
Download this release
Release Info
Developer | nimblechapps |
Plugin | Save Contact Form 7 |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.4
- Readme.txt +7 -2
- save-contact-form-7.php +171 -30
Readme.txt
CHANGED
@@ -3,10 +3,10 @@ Contributors: nimblechapps
|
|
3 |
Donate link: http://savecontactform7.com/donate
|
4 |
Tags: Save Contact Enquiry, Save Contact Inquiry, Save Contact Entries, Save Forms Data, Contact Form Storage, Contact Form Entry Storage, Contact Enquiry Storage, Contact Form Save, Storage Contact Enquiry, ContactFormDB, JetPack Contact Form, Contact Form 7, CF7, Fast Secure Contact Form, FSCF, Gravity Forms, WR ContactForm, Quform, Ninja Forms, Caldera Forms, Enfold theme forms, contactform7, Contact Form Advanced Database, Storage for Contact Form 7, cfdb, contact form 7 extension, contact form db extension, contact form, save contact form 7 to database
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.5.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
-
Stable tag: 1
|
10 |
|
11 |
|
12 |
Save Contact Form 7 data. Sort, search & export it in CSV+PDF. Best UI. Fully tested with WP 3.0 + CF7 2.4.6 & above. Totally Supported.
|
@@ -73,6 +73,11 @@ Select any form for which you want to download the entries, from the populated e
|
|
73 |
|
74 |
== Changelog ==
|
75 |
|
|
|
|
|
|
|
|
|
|
|
76 |
= 1.3 =
|
77 |
|
78 |
* Extension/Plugins like MailChimp extension, Dynamic Text Extension etc were creating hidden fields for their functional purpose, which were being stored unnecessarily in Save Contact Form 7, now it’s corrected to ignore those hidden form fields
|
3 |
Donate link: http://savecontactform7.com/donate
|
4 |
Tags: Save Contact Enquiry, Save Contact Inquiry, Save Contact Entries, Save Forms Data, Contact Form Storage, Contact Form Entry Storage, Contact Enquiry Storage, Contact Form Save, Storage Contact Enquiry, ContactFormDB, JetPack Contact Form, Contact Form 7, CF7, Fast Secure Contact Form, FSCF, Gravity Forms, WR ContactForm, Quform, Ninja Forms, Caldera Forms, Enfold theme forms, contactform7, Contact Form Advanced Database, Storage for Contact Form 7, cfdb, contact form 7 extension, contact form db extension, contact form, save contact form 7 to database
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.5.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
Stable tag: 1.4
|
10 |
|
11 |
|
12 |
Save Contact Form 7 data. Sort, search & export it in CSV+PDF. Best UI. Fully tested with WP 3.0 + CF7 2.4.6 & above. Totally Supported.
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 1.4 =
|
77 |
+
|
78 |
+
* Given setting page option to view/hide Record created Date and Time column.
|
79 |
+
|
80 |
+
|
81 |
= 1.3 =
|
82 |
|
83 |
* Extension/Plugins like MailChimp extension, Dynamic Text Extension etc were creating hidden fields for their functional purpose, which were being stored unnecessarily in Save Contact Form 7, now it’s corrected to ignore those hidden form fields
|
save-contact-form-7.php
CHANGED
@@ -6,13 +6,21 @@
|
|
6 |
Description: A simple plugin to save contact form data to db.
|
7 |
Author: Nimblechapps
|
8 |
Author URI: http://nimblechapps.com
|
9 |
-
Version: 1.
|
10 |
*/
|
11 |
//function to check dependencies for Contact Form 7 Plugin
|
12 |
|
13 |
if (!defined('ABSPATH')) {
|
14 |
exit;
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
if (is_admin()) {
|
17 |
|
18 |
// registering hooks for activation and deactivation of plugin
|
@@ -103,6 +111,13 @@ if (is_admin()) {
|
|
103 |
$position = 99;
|
104 |
//create new top-level menu
|
105 |
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
|
108 |
add_action('admin_menu', 'nimble_menu');
|
@@ -148,6 +163,7 @@ if (is_admin()) {
|
|
148 |
}
|
149 |
}
|
150 |
}
|
|
|
151 |
foreach ($cf7_form_names as $key => $value) {
|
152 |
$optcolor = ($key == "CF7-Deleted" ? 'red' : '');
|
153 |
echo "<optgroup label=" . $key . ">";
|
@@ -165,7 +181,68 @@ if (is_admin()) {
|
|
165 |
}
|
166 |
|
167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
// function to get submitted contact form 7 names
|
170 |
function nimble_get_cf7_name() {
|
171 |
global $wpdb;
|
@@ -187,6 +264,7 @@ if (is_admin()) {
|
|
187 |
function nimble_getFields($tab, $export, $isHeader = false) {
|
188 |
global $wpdb;
|
189 |
$nimble_dir_pah = wp_upload_dir();
|
|
|
190 |
$id = explode("_", $tab);
|
191 |
$col_with_cmnt = array();
|
192 |
$row_fields = $wpdb->get_results("SHOW full COLUMNS FROM $tab");
|
@@ -209,13 +287,24 @@ if (is_admin()) {
|
|
209 |
|
210 |
$sendingArr[] = ' IF( ' . $v->Field . ' IS NULL, "" , CONCAT("<a href=\'' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`,"\' target=\'_blank\' title=\'View-",' . $v->Field . ',"\' >","<i class=\'icon-view\'></i>","</a>"," ","<a href=\'' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`,"\' target=\'_blank\' title=\'Download-",' . $v->Field . ',"\' download>","<i class=\'icon-download\'></i>","</a>") ) as `' . $v->Field . '`';
|
211 |
|
212 |
-
|
213 |
$sendingArr[] = 'CONCAT("' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`," ")';
|
214 |
}
|
215 |
}
|
216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
$arr = array($sendingArr, $col_with_cmnt);
|
218 |
return $arr;
|
|
|
219 |
}
|
220 |
}
|
221 |
|
@@ -224,7 +313,6 @@ if (is_admin()) {
|
|
224 |
|
225 |
function nimble_populate_data() {
|
226 |
global $wpdb;
|
227 |
-
|
228 |
if (isset($_REQUEST['id'])) {
|
229 |
$id = $_REQUEST['id'];
|
230 |
}
|
@@ -234,23 +322,58 @@ if (is_admin()) {
|
|
234 |
$dt_columnslistCount = 0;
|
235 |
$table = "SaveContactForm7_" . $id;
|
236 |
$db_fields = nimble_getFields($table, $export, true);
|
|
|
|
|
237 |
if (!empty($db_fields)) {
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
}
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
-
$dt_columnslistCount++;
|
253 |
}
|
|
|
254 |
$dt_header .= '</tr></thead></table></div>';
|
255 |
$data['dt_header'] = $dt_header;
|
256 |
$data['dt_columnslist'] = rtrim($dt_columnslist, ",");
|
@@ -277,15 +400,34 @@ if (is_admin()) {
|
|
277 |
$table = "SaveContactForm7_" . $_POST['id'];
|
278 |
$db_fields = nimble_getFields($table, $export);
|
279 |
$i = 0;
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
}
|
288 |
-
|
289 |
$sql_details = array(
|
290 |
'user' => $wpdb->dbuser,
|
291 |
'pass' => $wpdb->dbpassword,
|
@@ -293,8 +435,11 @@ if (is_admin()) {
|
|
293 |
'host' => $wpdb->dbhost
|
294 |
);
|
295 |
/** for custom filter and export data ** */
|
|
|
296 |
if (isset($_REQUEST['searchvalue']) && $_REQUEST['searchvalue'] != '') {
|
297 |
$search = $_REQUEST['searchvalue'];
|
|
|
|
|
298 |
} else {
|
299 |
$search = '';
|
300 |
}
|
@@ -304,7 +449,7 @@ if (is_admin()) {
|
|
304 |
} else {
|
305 |
$columnorder = '';
|
306 |
}
|
307 |
-
|
308 |
/** for custom filter and export data code ends ** */
|
309 |
$primaryKey = 'id';
|
310 |
require( 'includes/ssp.class.php' );
|
@@ -318,14 +463,10 @@ if (is_admin()) {
|
|
318 |
$finalRows[$key] = $aa;
|
319 |
}
|
320 |
}
|
321 |
-
$data['data'] = $finalRows; //ajax response converted to json
|
322 |
-
$data['columns'] = array();
|
323 |
-
foreach ($columns as $value) {
|
324 |
-
$data['columns'][] = array_values($value);
|
325 |
-
}
|
326 |
-
echo json_encode($data);
|
327 |
-
wp_die();
|
328 |
}
|
|
|
|
|
|
|
329 |
}
|
330 |
|
331 |
}
|
6 |
Description: A simple plugin to save contact form data to db.
|
7 |
Author: Nimblechapps
|
8 |
Author URI: http://nimblechapps.com
|
9 |
+
Version: 1.4
|
10 |
*/
|
11 |
//function to check dependencies for Contact Form 7 Plugin
|
12 |
|
13 |
if (!defined('ABSPATH')) {
|
14 |
exit;
|
15 |
}
|
16 |
+
add_action('wp_head','nimble_scf7_ajaxurl');
|
17 |
+
function nimble_scf7_ajaxurl() {
|
18 |
+
?>
|
19 |
+
<script type="text/javascript">
|
20 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
21 |
+
</script>
|
22 |
+
<?php
|
23 |
+
}
|
24 |
if (is_admin()) {
|
25 |
|
26 |
// registering hooks for activation and deactivation of plugin
|
111 |
$position = 99;
|
112 |
//create new top-level menu
|
113 |
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
|
114 |
+
add_submenu_page(
|
115 |
+
$menu_slug, // admin page slug
|
116 |
+
'Save Contact Form 7 settings', // page title
|
117 |
+
'Settings', // menu title
|
118 |
+
'manage_options', // capability required to see the page
|
119 |
+
'nimble_settings', // admin page slug, e.g. options-general.php?page=wporg_options
|
120 |
+
'nimble_settings_page');
|
121 |
}
|
122 |
|
123 |
add_action('admin_menu', 'nimble_menu');
|
163 |
}
|
164 |
}
|
165 |
}
|
166 |
+
|
167 |
foreach ($cf7_form_names as $key => $value) {
|
168 |
$optcolor = ($key == "CF7-Deleted" ? 'red' : '');
|
169 |
echo "<optgroup label=" . $key . ">";
|
181 |
}
|
182 |
|
183 |
}
|
184 |
+
|
185 |
+
/********************************************************************************************************************************************** */
|
186 |
+
// code start for settings API use
|
187 |
+
/********************************************************************************************************************************************** */
|
188 |
+
|
189 |
+
add_action('admin_init', 'nimble_options');
|
190 |
+
|
191 |
+
function nimble_options() {
|
192 |
+
/* Display Options Section */
|
193 |
+
add_settings_section(
|
194 |
+
'nimble_display_page', '', 'nimble_display_section_callback', 'nimble_settings_options'
|
195 |
+
);
|
196 |
+
|
197 |
+
add_settings_field(
|
198 |
+
'nimble_scf7_display_created_date', 'Show Created Date Field', 'nimble_display_date_options_callback', 'nimble_settings_options', 'nimble_display_page'
|
199 |
+
);
|
200 |
+
|
201 |
+
|
202 |
+
register_setting('nimble_settings_options', 'nimble_scf7_display_created_date');
|
203 |
+
}
|
204 |
|
205 |
+
/* Call Backs
|
206 |
+
----------------------------------------------------------------- */
|
207 |
+
|
208 |
+
function nimble_display_section_callback() {
|
209 |
+
|
210 |
+
//echo '<p> Display Data Options:</p>';
|
211 |
+
}
|
212 |
+
|
213 |
+
function nimble_display_date_options_callback() {
|
214 |
+
|
215 |
+
echo '<input type="checkbox" id="nimble_scf7_display_created_date" name="nimble_scf7_display_created_date" value="1" ' . checked(1, get_option('nimble_scf7_display_created_date'), false) . '/> Display Entry Date & Time';
|
216 |
+
}
|
217 |
+
|
218 |
+
|
219 |
+
|
220 |
+
/* Display Page
|
221 |
+
----------------------------------------------------------------- */
|
222 |
+
|
223 |
+
function nimble_settings_page() {
|
224 |
+
global $wpdb;
|
225 |
+
settings_errors();
|
226 |
+
|
227 |
+
?>
|
228 |
+
|
229 |
+
<h2 class="nav-tab-wrapper">
|
230 |
+
Display Settings
|
231 |
+
</h2>
|
232 |
+
<form method="post" action="options.php">
|
233 |
+
<?php
|
234 |
+
settings_fields('nimble_settings_options');
|
235 |
+
do_settings_sections('nimble_settings_options');
|
236 |
+
?>
|
237 |
+
<?php submit_button(); ?>
|
238 |
+
</form>
|
239 |
+
<?php
|
240 |
+
}
|
241 |
+
|
242 |
+
/********************************************************************************************************************************************** */
|
243 |
+
// code after settings API use
|
244 |
+
/********************************************************************************************************************************************** */
|
245 |
+
|
246 |
// function to get submitted contact form 7 names
|
247 |
function nimble_get_cf7_name() {
|
248 |
global $wpdb;
|
264 |
function nimble_getFields($tab, $export, $isHeader = false) {
|
265 |
global $wpdb;
|
266 |
$nimble_dir_pah = wp_upload_dir();
|
267 |
+
$nimble_date_options = get_option('nimble_scf7_display_created_date');
|
268 |
$id = explode("_", $tab);
|
269 |
$col_with_cmnt = array();
|
270 |
$row_fields = $wpdb->get_results("SHOW full COLUMNS FROM $tab");
|
287 |
|
288 |
$sendingArr[] = ' IF( ' . $v->Field . ' IS NULL, "" , CONCAT("<a href=\'' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`,"\' target=\'_blank\' title=\'View-",' . $v->Field . ',"\' >","<i class=\'icon-view\'></i>","</a>"," ","<a href=\'' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`,"\' target=\'_blank\' title=\'Download-",' . $v->Field . ',"\' download>","<i class=\'icon-download\'></i>","</a>") ) as `' . $v->Field . '`';
|
289 |
|
|
|
290 |
$sendingArr[] = 'CONCAT("' . $nimble_dir_pah['baseurl'] . '/nimble_uploads/", `id`,"/",`' . $v->Field . '`," ")';
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
+
|
295 |
+
if($nimble_date_options !== "")
|
296 |
+
{
|
297 |
+
unset($col_with_cmnt[1]);
|
298 |
+
array_push($col_with_cmnt, "");
|
299 |
+
$aaaa=array_values($col_with_cmnt);
|
300 |
+
$arr = array($sendingArr, $aaaa);
|
301 |
+
return $arr;
|
302 |
+
}
|
303 |
+
else
|
304 |
+
{
|
305 |
$arr = array($sendingArr, $col_with_cmnt);
|
306 |
return $arr;
|
307 |
+
}
|
308 |
}
|
309 |
}
|
310 |
|
313 |
|
314 |
function nimble_populate_data() {
|
315 |
global $wpdb;
|
|
|
316 |
if (isset($_REQUEST['id'])) {
|
317 |
$id = $_REQUEST['id'];
|
318 |
}
|
322 |
$dt_columnslistCount = 0;
|
323 |
$table = "SaveContactForm7_" . $id;
|
324 |
$db_fields = nimble_getFields($table, $export, true);
|
325 |
+
$nimble_date_options = get_option('nimble_scf7_display_created_date');
|
326 |
+
|
327 |
if (!empty($db_fields)) {
|
328 |
+
|
329 |
+
if($nimble_date_options != "")
|
330 |
+
{
|
331 |
+
$i=0;
|
332 |
+
$header_create_date_index = array_splice($db_fields[0],1,1);
|
333 |
+
$header_fields_arr = array_merge($db_fields[0],$header_create_date_index);
|
334 |
+
|
335 |
+
foreach ($header_fields_arr as $db_field) { // loop for column header
|
336 |
+
if (!in_array($db_field, array("id"))) {
|
337 |
+
$columns[] = array("db" => $db_field, "dt" => $i);
|
338 |
+
$dt_header .= "<th align='left'>" . ucwords(str_replace("_", " ", $db_field)) . "</th>";
|
339 |
+
$i++;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
foreach ($db_fields[1] as $key => $value) { // loop for export options columns like [0,1,2,3,5] and target column
|
344 |
+
if ($key == 0 ) {
|
345 |
+
continue;
|
346 |
+
} elseif ($value == "") {
|
347 |
+
$dt_columnslist .= $dt_columnslistCount . ",";
|
348 |
+
} else {
|
349 |
+
$dt_column_target = $dt_columnslistCount + 1;
|
350 |
+
}
|
351 |
+
$dt_columnslistCount++;
|
352 |
}
|
353 |
}
|
354 |
+
else
|
355 |
+
{
|
356 |
+
$i=0;
|
357 |
+
foreach ($db_fields[0] as $db_field) { // loop for column header
|
358 |
+
if (!in_array($db_field, array("id", "created_on"))) {
|
359 |
+
$columns[] = array("db" => $db_field, "dt" => $i);
|
360 |
+
$dt_header .= "<th align='left'>" . ucwords(str_replace("_", " ", $db_field)) . "</th>";
|
361 |
+
$i++;
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
foreach ($db_fields[1] as $key => $value) { // loop for export options columns like [0,1,2,3,5] and target column
|
366 |
+
if ($key == 0 || $key == 1) {
|
367 |
+
continue;
|
368 |
+
} elseif ($value == "") {
|
369 |
+
$dt_columnslist .= $dt_columnslistCount . ",";
|
370 |
+
} else {
|
371 |
+
$dt_column_target = $dt_columnslistCount + 1;
|
372 |
+
}
|
373 |
+
$dt_columnslistCount++;
|
374 |
}
|
|
|
375 |
}
|
376 |
+
|
377 |
$dt_header .= '</tr></thead></table></div>';
|
378 |
$data['dt_header'] = $dt_header;
|
379 |
$data['dt_columnslist'] = rtrim($dt_columnslist, ",");
|
400 |
$table = "SaveContactForm7_" . $_POST['id'];
|
401 |
$db_fields = nimble_getFields($table, $export);
|
402 |
$i = 0;
|
403 |
+
$nimble_date_options = get_option('nimble_scf7_display_created_date');
|
404 |
+
|
405 |
+
if (!empty($db_fields))
|
406 |
+
{
|
407 |
+
if($nimble_date_options != "")
|
408 |
+
{
|
409 |
+
$i=0;
|
410 |
+
$header_create_date_index = array_splice($db_fields[0],1,1);
|
411 |
+
$header_fields_arr = array_merge($db_fields[0],$header_create_date_index);
|
412 |
+
|
413 |
+
foreach ($header_fields_arr as $db_field) { // loop for column header
|
414 |
+
if (!in_array($db_field, array("`id`"))) {
|
415 |
+
$columns[] = array("db" => $db_field, "dt" => $i);
|
416 |
+
$i++;
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
else
|
421 |
+
{
|
422 |
+
$i=0;
|
423 |
+
foreach ($db_fields[0] as $db_field) { // loop for column header
|
424 |
+
if (!in_array($db_field, array("`id`", "`created_on`"))) {
|
425 |
+
$columns[] = array("db" => $db_field, "dt" => $i);
|
426 |
+
$i++;
|
427 |
+
}
|
428 |
}
|
429 |
}
|
430 |
+
|
431 |
$sql_details = array(
|
432 |
'user' => $wpdb->dbuser,
|
433 |
'pass' => $wpdb->dbpassword,
|
435 |
'host' => $wpdb->dbhost
|
436 |
);
|
437 |
/** for custom filter and export data ** */
|
438 |
+
|
439 |
if (isset($_REQUEST['searchvalue']) && $_REQUEST['searchvalue'] != '') {
|
440 |
$search = $_REQUEST['searchvalue'];
|
441 |
+
|
442 |
+
|
443 |
} else {
|
444 |
$search = '';
|
445 |
}
|
449 |
} else {
|
450 |
$columnorder = '';
|
451 |
}
|
452 |
+
|
453 |
/** for custom filter and export data code ends ** */
|
454 |
$primaryKey = 'id';
|
455 |
require( 'includes/ssp.class.php' );
|
463 |
$finalRows[$key] = $aa;
|
464 |
}
|
465 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
+
|
468 |
+
echo json_encode($data);
|
469 |
+
wp_die();
|
470 |
}
|
471 |
|
472 |
}
|