Contact Form Submissions - Version 1.3.1

Version Description

  • Updated to only save fields that have a value
Download this release

Release Info

Developer jasongreen
Plugin Icon 128x128 Contact Form Submissions
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

Files changed (3) hide show
  1. Submissions.php +12 -7
  2. contact-form-submissions.php +1 -1
  3. readme.txt +6 -3
Submissions.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  class WPCF7Submissions {
3
-
4
  function __construct() {
5
  add_action('init', array($this, 'post_type') );
6
-
7
  add_filter('wpcf7_mail_components', array($this, 'submission'), 999, 3);
8
 
9
  add_action('pre_get_posts', array($this, 'disable_feed'));
@@ -33,7 +33,7 @@ class WPCF7Submissions {
33
  'show_in_admin_bar' => false,
34
  'show_in_nav_menus' => false,
35
  'can_export' => true,
36
- 'has_archive' => false,
37
  'exclude_from_search' => true,
38
  'publicly_queryable' => false,
39
  'rewrite' => false,
@@ -109,17 +109,22 @@ class WPCF7Submissions {
109
  if(isset($submission['parent'])){
110
  $post['post_parent'] = $submission['parent'];
111
  }
112
-
113
  $post_id = wp_insert_post($post);
114
-
115
  add_post_meta($post_id, 'form_id', $submission['form_id']);
116
  add_post_meta($post_id, 'subject', $submission['subject']);
117
  add_post_meta($post_id, 'sender', $submission['sender']);
118
  add_post_meta($post_id, 'recipient', $submission['recipient']);
119
  add_post_meta($post_id, 'additional_headers', $submission['additional_headers']);
 
120
 
121
- foreach($submission['fields'] as $name => $value){
122
- add_post_meta($post_id, 'wpcf7s_posted-' . $name, $value);
 
 
 
 
123
  }
124
 
125
  return $post_id;
1
  <?php
2
  class WPCF7Submissions {
3
+
4
  function __construct() {
5
  add_action('init', array($this, 'post_type') );
6
+
7
  add_filter('wpcf7_mail_components', array($this, 'submission'), 999, 3);
8
 
9
  add_action('pre_get_posts', array($this, 'disable_feed'));
33
  'show_in_admin_bar' => false,
34
  'show_in_nav_menus' => false,
35
  'can_export' => true,
36
+ 'has_archive' => false,
37
  'exclude_from_search' => true,
38
  'publicly_queryable' => false,
39
  'rewrite' => false,
109
  if(isset($submission['parent'])){
110
  $post['post_parent'] = $submission['parent'];
111
  }
112
+
113
  $post_id = wp_insert_post($post);
114
+
115
  add_post_meta($post_id, 'form_id', $submission['form_id']);
116
  add_post_meta($post_id, 'subject', $submission['subject']);
117
  add_post_meta($post_id, 'sender', $submission['sender']);
118
  add_post_meta($post_id, 'recipient', $submission['recipient']);
119
  add_post_meta($post_id, 'additional_headers', $submission['additional_headers']);
120
+ $additional_fields = $submission['fields'];
121
 
122
+ if(!empty($additional_fields)){
123
+ foreach($additional_fields as $name => $value){
124
+ if(!empty($value)){
125
+ add_post_meta($post_id, 'wpcf7s_posted-' . $name, $value);
126
+ }
127
+ }
128
  }
129
 
130
  return $post_id;
contact-form-submissions.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Contact Form Submissions
4
  Description: Never miss an enquiry again! Save all Contact Form 7 submissions in your database.
5
- Version: 1.3
6
  Author: Jason Green
7
  License: GPLv3
8
  Domain Path: /languages
2
  /*
3
  Plugin Name: Contact Form Submissions
4
  Description: Never miss an enquiry again! Save all Contact Form 7 submissions in your database.
5
+ Version: 1.3.1
6
  Author: Jason Green
7
  License: GPLv3
8
  Domain Path: /languages
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jasongreen
3
  Tags: contact form 7, save contact form, submissions, contact form db, cf7, wpcf7, contact form storage, contact form seven, contact form 7 db
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SNHXWSXSPYATE
5
  Requires at least: 3.0.1
6
- Tested up to: 4.4.2
7
- Stable tag: 1.3
8
  License: GPLv3
9
 
10
  Never miss an enquiry again! Save all Contact Form 7 submissions safely in your database.
@@ -37,6 +37,9 @@ None yet
37
 
38
  == Changelog ==
39
 
 
 
 
40
  = 1.3 =
41
  * Updated to now save all posted data seperately. This can be viewed in each Submission page.
42
 
@@ -55,4 +58,4 @@ None yet
55
  * Added checks for older versions of cf7
56
 
57
  = 1.0 =
58
- * First release
3
  Tags: contact form 7, save contact form, submissions, contact form db, cf7, wpcf7, contact form storage, contact form seven, contact form 7 db
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SNHXWSXSPYATE
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.5.1
7
+ Stable tag: 1.3.1
8
  License: GPLv3
9
 
10
  Never miss an enquiry again! Save all Contact Form 7 submissions safely in your database.
37
 
38
  == Changelog ==
39
 
40
+ = 1.3.1 =
41
+ * Updated to only save fields that have a value
42
+
43
  = 1.3 =
44
  * Updated to now save all posted data seperately. This can be viewed in each Submission page.
45
 
58
  * Added checks for older versions of cf7
59
 
60
  = 1.0 =
61
+ * First release