Wordpress plugins
Form Data Collector

Form Data Collector

Version : 1.3.2
Tested up to : 4.8.2
Number of download : 1068
Author : Prixal LLC
Average rating : 0 / 5 on 0 votes 0 votes, 0 avg.rating

Screenshots

Form Data Collector
Form Data Collector
Form Data Collector
Form Data Collector

This plugin is a developer’s tookit for collecting form data from your WordPress site. It provides the necessary hooks for you to manage how data is stored and displayed later. NOTE: Plugin will add “px_fdc” prefix to all form field names before they are stored in database. Since 1.3.0 you can store all fields as one array (read the Changelog). In HTML <form action="#" method="post" id="form"> <div style="position: absolute; left: -1000em;"><input type="text" name="pxnotempty" value="" /></div> <input type="text" name="itemID" /> <input type="text" name="cname" /> <input type="text" name="address2" /> <button type="button" class="js-submit">Submit</button> </form> Send form data via Ajax. $('.js-submit').on('click', function(e) { e.preventDefault(); fdc.ajax.post('#form', { success: function(data) { console.log(data); }, error: function(data) { console.log(data); } }); }); Use filter to remove fields that you don’t want to store in database function px_fdc_filter_data($data) { if( !empty($data['pxnotempty']) ) die(); $allowed_fields = array('itemID', 'cname', 'cemail', 'address2'); return array_intersect_key($data, array_flip($allowed_fields)); } add_filter('fdc_pre_save_meta', 'px_fdc_filter_data', 10, 1); Add columns to the Entries table in the Admin area. function px_fdc_table_list_columns($columns) { $columns = array( 'item' => 'Item', 'name' => 'Name' ); return $columns; } add_filter('fdc_table_list_columns', 'px_fdc_table_list_columns'); Add data to the Entries table columns function px_fdc_table_list_values($column_name, $item) { $post_id = $item->ID; switch($column_name) { case 'item': return get_post_meta($post_id, '_px_fdc_itemID', true); break; case 'name': return get_post_meta($post_id, '_px_fdc_cname', true); break; } } add_filter('fdc_table_list_columns_values', 'px_fdc_table_list_values', 10, 2); Control how data is displayed in the Entry Details modal. function px_fdc_overview_output($meta) { $new_meta = array(); $new_keys = array( '_px_fdc_itemID' => 'Car', '_px_fdc_cname' => 'Name' ); if( ! empty($meta) ) { foreach( $meta as $key => $value ) { if( isset($new_keys[$key]) ) { $new_meta[$new_keys[$key]]= $value; continue; } $new_meta[$key]= $value; } } return $new_meta; } add_filter('fdc_overview_details_output', 'px_fdc_overview_output'); Want to send email after form submit? You can use the fdc_before_email_send hook for that. function px_fdc_send_email($post_id, $toClient, $toYou) { $toClientContent = $toClient['content']; $toClientEmail = get_post_meta($post_id, '_px_fdc_CLIENT_EMAIL_FIELD_NAME', true); $toAdminEmail = $toYou['email']; $toAdminContent = $toYou['content']; wp_mail($toClientEmail, 'Email from my Website', $toClientContent); } add_action('fdc_before_email_send', 'px_fdc_send_email', 10, 3);

Download now