Contact Form Submissions - Version 1.3

Version Description

  • Updated to now save all posted data seperately. This can be viewed in each Submission page.
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.3

Files changed (4) hide show
  1. Admin.php +32 -0
  2. Submissions.php +16 -1
  3. contact-form-submissions.php +1 -1
  4. readme.txt +12 -7
Admin.php CHANGED
@@ -142,6 +142,7 @@ class WPCF7SAdmin {
142
 
143
  function meta_boxes(){
144
  add_meta_box( 'wpcf7s_mail', __('Mail', 'contact-form-submissions'), array($this, 'mail_meta_box'), 'wpcf7s', 'normal');
 
145
  add_meta_box( 'wpcf7s_actions', __('Overview', 'contact-form-submissions'), array($this, 'actions_meta_box'), 'wpcf7s', 'side');
146
  remove_meta_box( 'submitdiv', 'wpcf7s', 'side' );
147
  }
@@ -188,6 +189,25 @@ class WPCF7SAdmin {
188
 
189
  <?php
190
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  function actions_meta_box($post){
192
  $datef = __( 'M j, Y @ H:i' );
193
  $date = date_i18n( $datef, strtotime( $post->post_date ) );
@@ -203,4 +223,16 @@ class WPCF7SAdmin {
203
  </div>
204
  <?php
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
142
 
143
  function meta_boxes(){
144
  add_meta_box( 'wpcf7s_mail', __('Mail', 'contact-form-submissions'), array($this, 'mail_meta_box'), 'wpcf7s', 'normal');
145
+ add_meta_box( 'wpcf7s_posted', __('Posted', 'contact-form-submissions'), array($this, 'posted_meta_box'), 'wpcf7s', 'normal');
146
  add_meta_box( 'wpcf7s_actions', __('Overview', 'contact-form-submissions'), array($this, 'actions_meta_box'), 'wpcf7s', 'side');
147
  remove_meta_box( 'submitdiv', 'wpcf7s', 'side' );
148
  }
189
 
190
  <?php
191
  }
192
+
193
+ function posted_meta_box($post){
194
+ $values = $this->get_mail_posted_fields($post->ID);
195
+
196
+ ?>
197
+ <table class="form-table contact-form-submission">
198
+ <tbody>
199
+ <?php foreach($values as $key => $value){ ?>
200
+ <tr>
201
+ <th scope="row"><?php _e(str_replace('wpcf7s_posted-', '', $key), 'contact-form-submissions'); ?></th>
202
+ <td><?php echo is_serialized($value[0]) ? implode(', ', unserialize($value[0])) : $value[0]; ?></td>
203
+ </tr>
204
+ <?php } ?>
205
+ </tbody>
206
+ </table>
207
+
208
+ <?php
209
+ }
210
+
211
  function actions_meta_box($post){
212
  $datef = __( 'M j, Y @ H:i' );
213
  $date = date_i18n( $datef, strtotime( $post->post_date ) );
223
  </div>
224
  <?php
225
  }
226
+
227
+ function get_mail_posted_fields($post_id){
228
+ $post_meta = get_post_meta($post_id);
229
+ $posted = array_intersect_key(
230
+ $post_meta,
231
+ array_flip(array_filter(array_keys($post_meta), function($key) {
232
+ return preg_match('/^wpcf7s_posted-/', $key);
233
+ }))
234
+ );
235
+
236
+ return $posted;
237
+ }
238
  }
Submissions.php CHANGED
@@ -50,6 +50,16 @@ class WPCF7Submissions {
50
  function submission($components, $contact_form, $mail){
51
  global $wpcf7s_post_id;
52
 
 
 
 
 
 
 
 
 
 
 
53
  $contact_form_id = 0;
54
  if(method_exists($contact_form,'id')){
55
  $contact_form_id = $contact_form->id();
@@ -71,7 +81,8 @@ class WPCF7Submissions {
71
  'subject' => $subject,
72
  'recipient' => $recipient,
73
  'additional_headers' => $headers,
74
- 'attachments' => $attachments
 
75
  );
76
 
77
  if(!empty($wpcf7s_post_id)){
@@ -107,6 +118,10 @@ class WPCF7Submissions {
107
  add_post_meta($post_id, 'recipient', $submission['recipient']);
108
  add_post_meta($post_id, 'additional_headers', $submission['additional_headers']);
109
 
 
 
 
 
110
  return $post_id;
111
  }
112
 
50
  function submission($components, $contact_form, $mail){
51
  global $wpcf7s_post_id;
52
 
53
+ $submission = WPCF7_Submission::get_instance();
54
+ $submitted = $submission ? $submission->get_posted_data( $tagname ) : null;
55
+ if(null !== $submitted) {
56
+ foreach($submitted as $name => $value){
57
+ if('_wpcf7' !== substr($name, 0, 6)){
58
+ $fields[$name] = $value;
59
+ }
60
+ }
61
+ }
62
+
63
  $contact_form_id = 0;
64
  if(method_exists($contact_form,'id')){
65
  $contact_form_id = $contact_form->id();
81
  'subject' => $subject,
82
  'recipient' => $recipient,
83
  'additional_headers' => $headers,
84
+ 'attachments' => $attachments,
85
+ 'fields' => $fields
86
  );
87
 
88
  if(!empty($wpcf7s_post_id)){
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;
126
  }
127
 
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.2.2
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
6
  Author: Jason Green
7
  License: GPLv3
8
  Domain Path: /languages
readme.txt CHANGED
@@ -1,21 +1,23 @@
1
  === Plugin Name ===
2
  Contributors: jasongreen
3
- Tags: contact form 7, save contact form, submissions, contact form db, cf7, wpcf7, contact form storage
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.3.1
7
- Stable tag: 1.2.2
8
  License: GPLv3
9
 
10
- Never miss an enquiry again! Save all Contact Form 7 submissions in your database.
11
 
12
  == Description ==
13
 
14
- No configuration necessary. Once activated all contact form submissions will be saved in your database.
15
 
16
- Submissions are stored as posts so they can easily be managed using the default WordPress interface. You can filter subsmissions by searching, selecting individual contact forms or picking a date range.
17
 
18
- All submissions can easily be exported using the default WordPress exporter.
 
 
19
 
20
  == Installation ==
21
 
@@ -35,6 +37,9 @@ None yet
35
 
36
  == Changelog ==
37
 
 
 
 
38
  = 1.2.2 =
39
  * Minor update to remove PHP warning
40
 
1
  === Plugin Name ===
2
  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.
11
 
12
  == Description ==
13
 
14
+ Easy install, no configuration necessary. Once activated all contact form 7 submissions will be saved so you can view them in wp-admin.
15
 
16
+ Each submission is stored so they can be easily managed using the default WordPress interface. You can filter subsmissions by searching for keywords, selecting individual contact forms or picking a date range.
17
 
18
+ All submissions can be exported using the default WordPress exporter.
19
+
20
+ This plugin has no ads or donation links so you can use this on all your sites.
21
 
22
  == Installation ==
23
 
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
+
43
  = 1.2.2 =
44
  * Minor update to remove PHP warning
45