tlovett1 / custom-contact-forms

Build beautiful custom forms and manage submissions the WordPress way.
https://taylorlovett.com
161 stars 50 forks source link

Custom Contact Forms Build Status

Build beautiful custom forms and manage submissions the WordPress way. View live previews of your forms while you build them. Create powerful and exstensible forms for simple contact inquiries, sign ups, subscriptions, events, payments, etc.

Purpose

The problem of form creation in WordPress has been tackled many different ways. Custom Contact forms handles forms the WordPress way. The plugin provides a seamless user experience for managing your forms through the comfort of the WordPress media manager modal. CCF does not have as many features as some of it's competitors but instead provides you with just what you need. Custom Contact Forms is a legacy plugin name. The plugin can handle all types of forms not just contact forms.

Requirements

Installation

Install the plugin in WordPress, you can download a zip via Github and upload it using the WP plugin uploader.

Usage

You can create and manage forms within a post by clicking the Add Form button next to the Add Media button:

Add a form in a post

Select or create a new form and click Insert into post:

Insert a form into a post

You can also add a form to your theme or plugin using PHP:

if ( function_exists( 'ccf_output_form' ) ) {
    ccf_output_form( FORM_ID );
}

In case you want to use the shortcode, it is: [ccf_form id="FORMID"]. You can find the form ID in the existing forms table of the form manager or in the URL when directly editing a form.

Form Settings

Each form has a number of settings that you should understand.

Form Notifications

For each of your forms you can add email notifications (as many as you want). Email notifications will be sent when a form is successfully filled out. Each notification contains the following configurable settings:

Note: In order for form notification changes to take affect, you will need to save the form.

Post Creation

For each of your forms, you can have a post (or custom post type) created every time someone submits the form. This is an extremely powerful feature.

Fields

The building block of forms are fields. Each field has it's own set of settings that you can change on a per-field basis.

Standard Field Settings

Field Types

You can create forms using a number of field types. Certain field types of special field settings that are described below:

Normal Fields

Note: Choiceable fields all handle choices the same way. Choices can be set with a value and a label. Values are internal, and labels are visible to the end form user. If a choice does not have a value, the choice will not "count". Meaning the field will not be considered filled out if it's required.

Special Fields
Structure Fields

Submissions

CCF provides a very pretty table view for navigating your form submissions.

View Form Submissions

Click the Forms item in the administration menu. Click on the specific form for which you want to view submissions. Scroll to the Submissions meta box. Click one the eye icon to view more information for a specific submission.

Customizing the Form Submissions Table

In the Submissions meta box, you can add and remove columns. Click the cog icon at the top of the meta box to open the screen options panel. In this panel you can check which columns you would like to see in the table.

Download Form Submissions as CSV

In addition to being able to import/export forms with all fields and submissions, you can export submissions for individual forms as .CSV files. Click the icon within the form edit view like so:

Export Submissions as .CSV Files

Import/Export

Custom Contact Forms allows you to import and export forms and form submissions using the default WordPress importer/exporter functionality. You can export all your forms (with submissions) within the standard WordPress export view:

Export CCF Forms

You can also export a single form (with submissions) within the Edit Form screen:

Export Single CCF Form

Both export methods will produce a standard WordPress WXR file. You can import your WXR files using the standard WordPress importer:

Import CCF Forms

General Settings

Custom Contact Forms has a general settings page. Right now the only thing it contains is asset loading restriction which allows you to choose specific pages that form CSS and JS should be loaded on. This allows you to prevent a ton of unnecessary website bloat.

Frequently Asked Questions

Development

Setup

Follow the configuration instructions above to setup the plugin. I recommend developing the plugin locally in an environment such as Varying Vagrant Vagrants.

If you want to touch JavaScript or CSS, you will need to fire up Grunt. Assuming you have npm installed, you can setup and run Grunt like so:

First install Grunt:

npm install -g grunt-cli

Next install the node packages required by the plugin:

npm install

Finally, start Grunt watch. Whenever you edit JS or SCSS, the appropriate files will be compiled:

grunt watch

Testing

Within the terminal change directories to the plugin folder. Initialize your unit testing environment by running the following command:

For VVV users:

bash bin/install-wp-tests.sh wordpress_test root root localhost latest

For VIP Quickstart users:

bash bin/install-wp-tests.sh wordpress_test root '' localhost latest

where:

Run the plugin tests:

phpunit
Dockunit

This plugin contains a valid Dockunit file for running unit tests across a variety of environments locally (PHP 5.2 and 5.6). You can use Dockunit (after installing it via npm) by running:

dockunit

Extending the Plugin

Coming soon.

Issues

If you identify any errors or have an idea for improving the plugin, please open an issue.

License

Custom Contact Forms is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.