Contact Form Entries – Contact Form 7, WPforms and more - Version 1.0.4

Version Description

  • fixed empty entries(entry_details table creation failed on some mysql servers).
Download this release

Release Info

Developer asif876
Plugin Icon 128x128 Contact Form Entries – Contact Form 7, WPforms and more
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

contact-form-entries.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Contact Form Entries
4
  * Description: Save form submissions to the database from <a href="https://wordpress.org/plugins/contact-form-7/">Contact Form 7</a>, <a href="https://wordpress.org/plugins/jetpack/">JetPack Contact Form</a>, <a href="https://wordpress.org/plugins/ninja-forms/">Ninja Forms</a>, <a href="https://wordpress.org/plugins/formidable/">Formidable Forms</a>, <a href="http://codecanyon.net/item/quform-wordpress-form-builder/706149">Quform</a>, <a href="https://wordpress.org/plugins/cforms2/">cformsII</a>, <a href="https://wordpress.org/plugins/contact-form-plugin/">Contact Form by BestWebSoft</a>, <a href="https://wordpress.org/plugins/ultimate-form-builder-lite/">Ultimate Form Builder</a>, <a href="https://wordpress.org/plugins/caldera-forms/">Caldera Forms</a> and <a href="https://wordpress.org/plugins/wpforms-lite/">WP Forms</a>.
5
- * Version: 1.0.3
6
  * Requires at least: 3.8
7
  * Tested up to: 5.1
8
  * Author URI: https://www.crmperks.com
@@ -15,7 +15,11 @@ if( !defined( 'ABSPATH' ) ) exit;
15
 
16
  if( !class_exists( 'vxcf_form' ) ):
17
 
18
-
 
 
 
 
19
  class vxcf_form {
20
 
21
 
@@ -26,7 +30,7 @@ class vxcf_form {
26
  public static $type = "vxcf_form";
27
  public static $path = '';
28
 
29
- public static $version = '1.0.3';
30
  public static $upload_folder = 'crm_perks_uploads';
31
  public static $db_version='';
32
  public static $base_url='';
@@ -133,7 +137,8 @@ $pro_file=self::$path . 'pro/add-ons.php';
133
  if(file_exists($pro_file)){ include_once($pro_file); }
134
  $pro_file=self::$path . 'wp/crmperks-notices.php';
135
  if(file_exists($pro_file)){ include_once($pro_file); }
136
- //$forms=vxcf_form::get_forms();
 
137
  }
138
 
139
  }
@@ -367,6 +372,21 @@ if($this->do_actions()){
367
  do_action('vx_addons_save_entry',$entry_id,$lead,'cf',$form);
368
  }
369
  $lead=apply_filters('vxcf_after_saving_addons',$lead,$entry_id,$type,$form);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
  $form['form_id']=$form['id']=$form_id;
372
  do_action('vxcf_entry_created',$lead,$entry_id,$form);
@@ -1207,7 +1227,7 @@ public static function file_link($file_url,$base_url=''){
1207
  if(empty($base_url)){
1208
  $upload=vxcf_form::get_upload_dir();
1209
  $base_url=$upload['url'];
1210
- }
1211
  $file_url=$base_url.$file_url;
1212
  }
1213
  if(filter_var($file_url,FILTER_VALIDATE_URL)){
@@ -1720,13 +1740,28 @@ $tags=$manager->get_scanned_tags();
1720
  if(is_array($tags)){
1721
  foreach($tags as $tag){
1722
  if(is_object($tag)){ $tag=(array)$tag; }
 
1723
  if(!empty($tag['name'])){
1724
  $id=str_replace(' ','',$tag['name']);
1725
- $tag['label']=ucwords(str_replace(array('-','_')," ",$tag['name']));
1726
- $tag['type_']=$tag['type'];
1727
- $tag['type']=$tag['basetype'];
1728
- $tag['req']=strpos($tag['type'],'*') !==false ? 'true' : '';
1729
- $fields[$id]=$tag;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1730
  }
1731
  }
1732
  }
2
  /**
3
  * Plugin Name: Contact Form Entries
4
  * Description: Save form submissions to the database from <a href="https://wordpress.org/plugins/contact-form-7/">Contact Form 7</a>, <a href="https://wordpress.org/plugins/jetpack/">JetPack Contact Form</a>, <a href="https://wordpress.org/plugins/ninja-forms/">Ninja Forms</a>, <a href="https://wordpress.org/plugins/formidable/">Formidable Forms</a>, <a href="http://codecanyon.net/item/quform-wordpress-form-builder/706149">Quform</a>, <a href="https://wordpress.org/plugins/cforms2/">cformsII</a>, <a href="https://wordpress.org/plugins/contact-form-plugin/">Contact Form by BestWebSoft</a>, <a href="https://wordpress.org/plugins/ultimate-form-builder-lite/">Ultimate Form Builder</a>, <a href="https://wordpress.org/plugins/caldera-forms/">Caldera Forms</a> and <a href="https://wordpress.org/plugins/wpforms-lite/">WP Forms</a>.
5
+ * Version: 1.0.4
6
  * Requires at least: 3.8
7
  * Tested up to: 5.1
8
  * Author URI: https://www.crmperks.com
15
 
16
  if( !class_exists( 'vxcf_form' ) ):
17
 
18
+ /**
19
+ * Main class
20
+ *
21
+ * @since 1.0.0
22
+ */
23
  class vxcf_form {
24
 
25
 
30
  public static $type = "vxcf_form";
31
  public static $path = '';
32
 
33
+ public static $version = '1.0.4';
34
  public static $upload_folder = 'crm_perks_uploads';
35
  public static $db_version='';
36
  public static $base_url='';
137
  if(file_exists($pro_file)){ include_once($pro_file); }
138
  $pro_file=self::$path . 'wp/crmperks-notices.php';
139
  if(file_exists($pro_file)){ include_once($pro_file); }
140
+ //$forms=vxcf_form::get_forms();
141
+
142
  }
143
 
144
  }
372
  do_action('vx_addons_save_entry',$entry_id,$lead,'cf',$form);
373
  }
374
  $lead=apply_filters('vxcf_after_saving_addons',$lead,$entry_id,$type,$form);
375
+ /*$upload=vxcf_form::get_upload_dir();
376
+ foreach($lead as $k=>$v){
377
+ if(isset($form['fields'][$k]['type']) && $form['fields'][$k]['type'] == 'file' && !empty($v)){
378
+ if(is_string($v)){ $v=array($v); }
379
+ $files=array();
380
+ foreach($v as $f){
381
+ if(filter_var($f,FILTER_VALIDATE_URL) === false){
382
+ $base_url=$upload['url'];
383
+ $f=$base_url.$f;
384
+ }
385
+ $files[]=$f;
386
+ }
387
+ $lead[$k]=$files;
388
+ }
389
+ }*/
390
 
391
  $form['form_id']=$form['id']=$form_id;
392
  do_action('vxcf_entry_created',$lead,$entry_id,$form);
1227
  if(empty($base_url)){
1228
  $upload=vxcf_form::get_upload_dir();
1229
  $base_url=$upload['url'];
1230
+ }
1231
  $file_url=$base_url.$file_url;
1232
  }
1233
  if(filter_var($file_url,FILTER_VALIDATE_URL)){
1740
  if(is_array($tags)){
1741
  foreach($tags as $tag){
1742
  if(is_object($tag)){ $tag=(array)$tag; }
1743
+
1744
  if(!empty($tag['name'])){
1745
  $id=str_replace(' ','',$tag['name']);
1746
+ $field=array('name'=>$id);
1747
+ $field['label']=ucwords(str_replace(array('-','_')," ",$tag['name']));
1748
+ $field['type_']=$tag['type'];
1749
+ $field['type']=$tag['basetype'];
1750
+ $field['req']=strpos($tag['type'],'*') !==false ? 'true' : '';
1751
+ if(!empty($tag['raw_values'])){
1752
+ $ops=array();
1753
+ foreach($tag['raw_values'] as $v){
1754
+ if(strpos($v,'|') !== false){
1755
+ $v_arr=explode('|',$v);
1756
+ if(!isset($v_arr[1])){ $v_arr[1]=$v_arr[0]; }
1757
+ $ops[]=array('label'=>$v_arr[0],'value'=>$v_arr[1]);
1758
+ }else{
1759
+ $ops[]=array('label'=>$v,'value'=>$v);
1760
+ }
1761
+ }
1762
+ $field['values']=$ops;
1763
+ }
1764
+ $fields[$id]=$field;
1765
  }
1766
  }
1767
  }
includes/data.php CHANGED
@@ -21,14 +21,14 @@ class vxcf_form_data{
21
 
22
  require_once(ABSPATH . '/wp-admin/includes/upgrade.php');
23
 
24
- if ( ! empty($wpdb->charset) )
25
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
26
- if ( ! empty($wpdb->collate) )
27
- $charset_collate .= " COLLATE $wpdb->collate";
28
 
29
  $sql = "CREATE TABLE $table_name (
30
- id bigint(20) unsigned not null auto_increment,
31
- form_id varchar(50) not null,
32
  `status` int(4) NOT NULL default 0,
33
  `type` int(4) NOT NULL DEFAULT 0,
34
  `is_read` BOOLEAN NOT NULL default 0,
@@ -43,27 +43,27 @@ class vxcf_form_data{
43
  `meta` text ,
44
  `created` datetime,
45
  `updated` datetime,
46
- INDEX (form_id),
47
- INDEX (status),
48
- INDEX (type),
49
  PRIMARY KEY (id)
50
  )$charset_collate; ";
51
 
52
- dbDelta($sql);
53
 
54
  $table_name = $this->get_crm_table_name('detail');
55
 
56
- $sql= "CREATE TABLE $table_name (
57
- id bigint(20) unsigned not null auto_increment,
58
- lead_id bigint(20) unsigned not null default 0,
59
  `name` varchar(250) not null,
60
  `value` longtext ,
61
- INDEX (lead_id),
62
- INDEX (name),
63
  PRIMARY KEY (id)
64
  )$charset_collate;";
65
 
66
- dbDelta($sql);
67
 
68
  ////////////////notes table
69
  $table_name = $this->get_crm_table_name('notes');
@@ -76,7 +76,7 @@ class vxcf_form_data{
76
  `email` varchar(150) NULL,
77
  `note` text,
78
  `created` datetime,
79
- INDEX (lead_id),
80
  PRIMARY KEY (id)
81
  ) $charset_collate;";
82
 
@@ -249,9 +249,9 @@ if($status == 'stared'){
249
 
250
  if(isset($req['type'])){ $search.=' and l.type ='.(int)vxcf_form::post('type',$req); }
251
  if(isset($req['user_id'])){ $search.=' and l.user_id ='.(int)vxcf_form::post('user_id',$req); }
252
- $time_key=vxcf_form::post('time',$req);
253
  // handle search
254
- $search=$this->add_time_sql($search,$time_key);
255
 
256
  if(vxcf_form::post('search',$req)!=""){
257
  $search_s=esc_sql(vxcf_form::post('search',$req));
@@ -403,8 +403,10 @@ if(!empty($res)){
403
  return array("min"=>$range_min,"max"=>$range_max,"items"=>$items,"links"=>$page_links,'result'=>$leads);
404
  //
405
  }
406
- public function add_time_sql($search,$time_key){
407
-
 
 
408
  $time=current_time('timestamp');
409
 
410
  $offset = vxcf_form::time_offset();
@@ -426,12 +428,15 @@ public function add_time_sql($search,$time_key){
426
 
427
  break;
428
  case"custom":
429
-
430
- if(!empty($_GET['start_date'])){
431
- $start_date=strtotime(vxcf_form::post('start_date').' 00:00:00');
 
 
 
432
  }
433
- if(!empty($_GET['end_date'])){
434
- $end_date=strtotime(vxcf_form::post('end_date').' 23:59:59');
435
  }
436
  break;
437
  }
@@ -499,6 +504,7 @@ public function get_lead_detail($lead_id){
499
  $detail_table = $this->get_crm_table_name('detail');
500
  $sql=$wpdb->prepare("Select * from {$detail_table} where lead_id=%d",$lead_id);
501
  $detail_arr=$wpdb->get_results($sql,ARRAY_A);
 
502
  $detail=array();
503
  if(is_array($detail_arr)){
504
  foreach($detail_arr as $v){
21
 
22
  require_once(ABSPATH . '/wp-admin/includes/upgrade.php');
23
 
24
+ $charset_collate='';
25
+ if ( $wpdb->has_cap( 'collation' ) ) {
26
+ $charset_collate = $wpdb->get_charset_collate();
27
+ }
28
 
29
  $sql = "CREATE TABLE $table_name (
30
+ `id` bigint(20) unsigned not null auto_increment,
31
+ `form_id` varchar(50) not null,
32
  `status` int(4) NOT NULL default 0,
33
  `type` int(4) NOT NULL DEFAULT 0,
34
  `is_read` BOOLEAN NOT NULL default 0,
43
  `meta` text ,
44
  `created` datetime,
45
  `updated` datetime,
46
+ KEY form_id (form_id),
47
+ KEY status (status),
48
+ KEY type (type),
49
  PRIMARY KEY (id)
50
  )$charset_collate; ";
51
 
52
+ // dbDelta($sql);
53
 
54
  $table_name = $this->get_crm_table_name('detail');
55
 
56
+ $sql.= "CREATE TABLE $table_name (
57
+ `id` bigint(20) unsigned not null auto_increment,
58
+ `lead_id` bigint(20) unsigned not null default 0,
59
  `name` varchar(250) not null,
60
  `value` longtext ,
61
+ KEY lead_id (lead_id),
62
+ KEY name (name(190)),
63
  PRIMARY KEY (id)
64
  )$charset_collate;";
65
 
66
+ // dbDelta($sql);
67
 
68
  ////////////////notes table
69
  $table_name = $this->get_crm_table_name('notes');
76
  `email` varchar(150) NULL,
77
  `note` text,
78
  `created` datetime,
79
+ KEY lead_id (lead_id),
80
  PRIMARY KEY (id)
81
  ) $charset_collate;";
82
 
249
 
250
  if(isset($req['type'])){ $search.=' and l.type ='.(int)vxcf_form::post('type',$req); }
251
  if(isset($req['user_id'])){ $search.=' and l.user_id ='.(int)vxcf_form::post('user_id',$req); }
252
+
253
  // handle search
254
+ $search=$this->add_time_sql($search,$req);
255
 
256
  if(vxcf_form::post('search',$req)!=""){
257
  $search_s=esc_sql(vxcf_form::post('search',$req));
403
  return array("min"=>$range_min,"max"=>$range_max,"items"=>$items,"links"=>$page_links,'result'=>$leads);
404
  //
405
  }
406
+ public function add_time_sql($search,$req){
407
+ if(is_array($req)){
408
+ $time_key=vxcf_form::post('time',$req);
409
+ }else{ $time_key=$req; }
410
  $time=current_time('timestamp');
411
 
412
  $offset = vxcf_form::time_offset();
428
 
429
  break;
430
  case"custom":
431
+ $start_date='';
432
+ if(!is_array($req)){
433
+ $req=$_GET;
434
+ }
435
+ if(!empty($req['start_date'])){
436
+ $start_date=strtotime(vxcf_form::post('start_date',$req).' 00:00:00');
437
  }
438
+ if(!empty($req['end_date'])){
439
+ $end_date=strtotime(vxcf_form::post('end_date',$req).' 23:59:59');
440
  }
441
  break;
442
  }
504
  $detail_table = $this->get_crm_table_name('detail');
505
  $sql=$wpdb->prepare("Select * from {$detail_table} where lead_id=%d",$lead_id);
506
  $detail_arr=$wpdb->get_results($sql,ARRAY_A);
507
+
508
  $detail=array();
509
  if(is_array($detail_arr)){
510
  foreach($detail_arr as $v){
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: crmperks, sbazzi
3
  Tags: contact form 7, contact form 7 database, contact form db, save contact form, contact form 7 entries
4
  Requires at least: 3.8
5
  Tested up to: 5.1
6
- Stable tag: 1.0.3
7
- Version: 1.0.3
8
  Requires PHP: 5.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -13,7 +13,7 @@ Saves Contact Form 7, CRM Perks Forms and many other contact form submissions to
13
 
14
  == Description ==
15
 
16
- Contact Form 7 Entries Plugin automatically saves form submissions from Contact Form 7, CRM Perks Forms and many other popular contact form plugins to wordpress database when anyone submits a form. Learn more at [crmperks.com](https://www.crmperks.com/plugins/contact-form-plugins/crm-perks-forms/?utm_source=wordpress&utm_medium=directory&utm_campaign=readme)
17
 
18
  == Supported Contact Forms ==
19
 
@@ -158,6 +158,9 @@ Contact form 7 entries plugin allows you to save contact form 7 entries to local
158
 
159
  == Changelog ==
160
 
 
 
 
161
  = 1.0.3 =
162
  * fixed Export Entries feature.
163
 
3
  Tags: contact form 7, contact form 7 database, contact form db, save contact form, contact form 7 entries
4
  Requires at least: 3.8
5
  Tested up to: 5.1
6
+ Stable tag: 1.0.4
7
+ Version: 1.0.4
8
  Requires PHP: 5.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
 
14
  == Description ==
15
 
16
+ Contact Form 7 Entries Plugin automatically saves form submissions from Contact Form 7, CRM Perks Forms and many other popular contact form plugins to wordpress database when anyone submits a form. Learn more our forms builder and entries at [crmperks.com](https://www.crmperks.com/plugins/contact-form-plugins/crm-perks-forms/?utm_source=wordpress&utm_medium=directory&utm_campaign=readme)
17
 
18
  == Supported Contact Forms ==
19
 
158
 
159
  == Changelog ==
160
 
161
+ = 1.0.4 =
162
+ * fixed empty entries(entry_details table creation failed on some mysql servers).
163
+
164
  = 1.0.3 =
165
  * fixed Export Entries feature.
166
 
templates/view.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
- } //var_dump($fields); die();
5
  ?><style type="text/css">
6
  label span.howto { cursor: default; }
7
 
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
+ } // var_dump($fields); // die();
5
  ?><style type="text/css">
6
  label span.howto { cursor: default; }
7
 
wp/crmperks-notices.php CHANGED
@@ -105,7 +105,7 @@ public function review_notice() {
105
  update_option($this->option."_install_data",$install_time,false);
106
  }
107
 
108
- $time=current_time( 'timestamp' , 1 )-(3600);
109
  if(!empty($install_time) && is_array($install_time) && !empty($install_time['time']) && empty($install_time['review_closed'])){
110
  $time_i=(int)$install_time['time'];
111
  if($time > $time_i){
105
  update_option($this->option."_install_data",$install_time,false);
106
  }
107
 
108
+ $time=current_time( 'timestamp' , 1 )-(3600*24);
109
  if(!empty($install_time) && is_array($install_time) && !empty($install_time['time']) && empty($install_time['review_closed'])){
110
  $time_i=(int)$install_time['time'];
111
  if($time > $time_i){