We have integrated some lead capturing capabilities from one of the most popular free contact forms (contact form 7) to put the contact right into your WP Contacts database. This opens up all new possibilities for how you use WP Contacts. The method we use is very flexible, giving you the opportunity to associate your form fields with almost any field you create in the database, assign it to someone and preset some values for the form capture!
Table of Contents
Open Table of Contents
First Steps
Please be sure to read all instructions carefully so that you create your lead capture correctly
Of course with Contact Form 7 you can have multiple forms that serve different purposes and each form can capture data differently than the rest.
One thing of note – you’ll need to pay extra special attention to your form field names and column names that you’ll be mapping to or you won’t get the data you want.
If you are familiar with Contact Form 7, each form you create has several shortcode tags used for various fields. We’ve added a custom hidden field that maps fields you’ve set and lets you pre-set other values that you want to be pre-defined for the entry to be added to WP Contacts database.
WP Contacts shortcode usage in Contact Form 7
below is an example of our shortcode added to a Contact Form 7 contact form along with the standard fields:
Our shortcode is the entire wpcontacts shortcode block shown above. Each entry is separated by a line ending (return) and the format is important! . Within the shortcode you will see wpfieldmap entries and other entries. The wpfieldmap entries are set up in a format of:
wpfieldmap=form-field-name:wpcontacts-column-name
With these entries you are mapping the Contact Form 7 field name to the WP Contacts column name, be sure to use the equal sign (=) and colon to format the entry.
All of the entries below the wpfieldmap entries are directly set fields by you that you want to set for your contact using the WP Contacts column name on the left and the value on the right. A handful of builtin fields do not need to be set by you as they are set at the time of creation, these fields are id, creation_date, updated_date, created_by, and updated_by so please do not try to set these as that can confuse things. Any other field that exists or that you create can be set or mapped.
- Enclose the fields with the wpcontacts shortcode container ([wpcontacts]…[/wpcontacts]
- Put 1 entry per line
- Fields filled out in the form use the wpfieldmap format to map the Contact Form 7 field name to the WP Contacts column
- Fields you want to pre set for the entry use the WP Contacts fieldname=value format
- If your form names change or you delete a field in the database, you’ll need to update the wpcontacts shortcode with the new information as well.
Valid WP Contacts Field names for use
- owned_by (the name of the individual you want the entry assigned to, defaults to none)
- l_source (if not set defaults to the default source)
- l_status (if not set defaults to the default status)
- l_type (if not set defaults to the default type)
- first_name
- last_name
- extra_column_x (custom fields you’ve created where x is the numbered custom field)
- wpdatabasemap Optionally assign the database by name that the entry should populate into. Otherwise the entry will go to your default database. Be sure to map the fields according to the correct database you are using!
- wpcontact_uploads (version 3.0.6 and above) optionally add this entry to enable file uploads to map to WP Contacts from Contact Form 7. You must add this if you want your Contact Form 7 file uploads to be saved in WP Contacts.
Referencing WP Contacts Field Names
In order to reference the correct field names to use to associate the form with WP Contacts use your Manage Fields page in WP Contacts. On this page you can reference the field label text of the field you wish to use. In the scenario shown below the email address field is associated with extra_column_6 .
Once you have the fields set up correctly you’ll start receiving form submission entries from Contact Form 7 in WP Contacts!