Advanced Custom Fields Contact Form Extension (Beta)

Overview

Advanced Custom Fields Contact Form Extension (Beta)

This is an extension for Advanced Custom Fields 5 for Wordpress, which enables you to create a contact form using an existing Field Group in ACF. It will also add a new post to a Custom Post Type of your choosing.

##Requirements

  • Advanced Custom Fields 5
  • jQuery

##Future Additions

  • More field support
  • Export form submissions

##Supported Fields Currently, this plugin supports the following fields:

  • Text Field
  • Email Field
  • Select Field
  • Checkbox Field
  • Radio Field
  • Post Object Field
  • Tabs
  • Text Area
  • Number
  • URL
  • Repeater
  • User
  • Taxonomy
  • oEmbed (links to edit post screen in wp-admin)
  • Password
  • Page Link
  • Image*
  • File*

I will add support for all other fields in the future.

##Installation

  • Download this plugin and upload it to your wp-content/plugins folder
  • Activate the "Advanced Custom Fields Contact Forms" plugin in your WordPress admin

##Creating a form

  • Create a Custom Post Type (You may want to make your post type NON-public)
  • Create a Field Group
  • Add fields to your Field Group. These will be your form fields. (See Supported Fields).
  • Add your Custom Post Type to the Location Rules under your Field Group
  • Go to the ACF Forms options page (/wp-admin/admin.php?page=acf-options-acf-forms)
  • Add a Form Rule
    • Post Type: Select your Custom Post Type
    • Field Group: Select your Field Group
    • Title: Enter the text you would like to appear in your email Subject and Post Title. You can use the form field values by using the acf shortcode and using "newpost" for the post_id.Example: New Inquiry by [acf field="first_name" post_id="newpost"] [acf field="last_name" post_id="newpost"]
    • Admin Email: Enter the email address you would like form submissions to be sent to.
    • Don't Send Email: Check this box if you only want to record form submissions in WordPress, without sending an email
    • Admin Email Template: Select the custom templace you want to be used for the Admin email, or leave blank to use the default template provided by the plugin
    • Customer Email: The name of the field within the Field Group where the customer will be inputting their email address. Whatever the customer inputs in this form field will be used as the recipient of the Customer Confirmation Email
    • Customer Email Title: This will be used as the subject line of the customer email.
    • Don't Send Customer Email: Check this box if you DO NOT want to send a confirmation email to the customer. (This is checked by default)
    • Customer Email Template: Select the custom templace you want to be used for the Customer Confirmation email, or leave blank to use the default template provided by the plugin

##Custom Email Templates To send emails using a custom HTML template, simply create a template using the_field() and get_field() functions provided by ACF to display the custom field values from the form submission. This feature is helpful if you need to parse the form data before it gets emailed to you.

Example:

the_field('first_name'); ?> the_field('last_name'); ?> has submitted an inquiry.p>

  • Templates must be placed within a directory in your current theme named "acf-cf-templates"
  • Name your template according to the following convention: "acf-cf-[TITLE].php" ([TITLE] can be anything you want)
  • Templates will appear under the Admin Email Template and Customer Email Template dropdowns in the ACF Forms options page. Select the template you want to use for each form.

##Akismet Spam Filtering To enable Akismet validation in your form, add the following classes to the corresponding form fields you would like to validate, under "Wrapper Attributes." You must have Akismet enabled.

  • akismet-name
  • akismet-email
  • akismet-url
  • akismet-message

##Placing a form in your page

To place a form in your page content, use this shortcode, and use the ID number of the Form Rule you want to use from your ACF Form options page. Example: [acf_contact id="1"]. Other parameters for the acf_contact shortcode include:

  • form_attributes
  • html_before_fields
  • html_after_fields
  • submit_value
  • updated_message
  • label_placement
  • instruction_placement
  • field_el, uploader
  • return

These parameters are taken from the acf_form() function parameters - please refer to this page for usage: http://www.advancedcustomfields.com/resources/acf_form/

###Placing a form in your theme

To use it within your template, add this before any other HTML (before get_header()):

 acf_form_head(); ?>

Then add this where you want the form to appear:

">
 do_shortcode('[acf_contact id="1"]'); ?>
Comments
  • No locale in Mail Templates

    No locale in Mail Templates

    Hi again,

    finally I have another problem. Inside the acf mail templates I can use any WP function BUT there is no locale set. If you try to echo get_locale(); it will be empty in the email. Since I currently develop a multilingual website I have to use the wp translation functions like __() or _e() but these do not work without locale. Even if I set locale inside a mail template (e.g. setlocale(LC_ALL, 'en_US'); ) it does not work. Can you help me Christine?

    opened by derby 5
  • field-wrapper attributes

    field-wrapper attributes

    Hi again,

    fields in the frontend forms do no contain the wrapper-attributes (id, class, width) specified in the field group. This does not seem to be very complicated, so I can try to add this feature. Can you give me a hint for a good implementation?

    opened by derby 5
  • Email template not working

    Email template not working

    Hi cpham,

    First of all, good job on this wonderful plugin! Saved me a lot of headache.

    Should the email template be of any particular formal/structure? I've followed the instructions, but couldn't get the email sent using a template. It was okay without using any template. Is this a known bug, or it has got to do with the template itself?

    opened by apitlekays 5
  • How does the Post Type work on ACF Forms?

    How does the Post Type work on ACF Forms?

    Hello,

    More of a question than a bug, I don't fully understand what the "Post Type" option in "Basic Settings" is doing. Could you clarify, explain a little bit in more detail please?

    I have it set to "custom_css" at the moment, which works - but I hate not understanding what it's doing so if anything ever breaks, I can resolve it!

    Thanks a lot! Great plugin by the way.

    The more plugins for ACF the better! 👍

    screen shot 2016-12-13 at 15 49 57

    opened by elliottmangham 3
  • Suggestion for Mail Preview

    Suggestion for Mail Preview

    Hi Christine,

    I created an action for previewing my mail templates. It works like this: For Preview you can go to any frontpage on your website, all you have to do is append a GET Variable to the URL: ?acf-mail-preview=[name-of-your-template-file] Example: Your website URL is: http://website.com Your ACF-Mail-Template is: acf-cf-website-admin.php Then you can preview the Mail like this: http://website.com?acf-mail-preview=acf-cf-website-admin All you have to do is inserting the following code e.g. to your functions.php or put it into your plugin:

    add_action('template_redirect', function()
    {
      if ( !isset($_GET['acf-mail-preview']) || empty($_GET['acf-mail-preview']) ) return;
      $mail_template = get_template_directory().'/acf-cf-templates/acf-cf-'.$_GET['acf-mail-preview'].'.php';
      if ( !file_exists($mail_template) ) return;
      include_once($mail_template);
      die();
    });
    

    Since Mail Preview is on your roadmap I thought you could create an iframe on the ACF-Forms Options Page or simply create a preview link which contains the GET Variable.

    Best regards, Torben

    opened by derby 3
  • Confirmation message and email for sender

    Confirmation message and email for sender

    Hi, nice plugin, I thought about building an act form plugin but then I found yours ;-) There are a few thing I still miss:

    1. It would be nice to have the option to send a confirmation email to the user/ sender
    2. After successfull form submission there is only the possibility to redirect to an internal page. It would be nice if either:
    • form submission could be done via ajax and on success there will appear a customizable message.
    • redirect could be a custom URL so that I can redirect to the same page and adding custom GET Variables to the URL, e.g. /contact?sent=success. Inside the page template I could then decide to show page content or success message.

    Or is there maybe an action hook, that reacts on success?

    opened by derby 3
  • Hidden field

    Hidden field

    Hey,

    I really like what you have done with this so far - its really cool.

    I just wanted to ask if you could think of a way to add a hidden field to the form before it's submitted. In my case all I want to do is add the title of the current post to the form so it can be displayed along with the results.

    I imagine the simplest way would be to write a function that echos get_the_title() into the results somehow, but I'm not sure where to start with that.

    Any ideas?

    Thanks!

    opened by edflips 2
  • allow_url_fopen required for plugin to send email templates

    allow_url_fopen required for plugin to send email templates

    I'm getting an error on a web server that does not allow me to turn on allow_url_fopen in PHP. This happens after the user submits the form - seemingly when your code is attempting to fetch the email template.

    May want to update this to use CURL instead or somehow make this a configuration option:

    Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /wp-content/plugins/acf-contact-form-master/acf-contact-process.php on line 62
    
    Warning: file_get_contents(http://www.....com?acf-cf-email=377&key=6537): failed to open stream: no suitable wrapper could be found in /wp-content/plugins/acf-contact-form-master/acf-contact-process.php on line 62
    
    Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /wp-content/plugins/acf-contact-form-master/acf-contact-process.php on line 63
    
    Warning: file_get_contents(http://www.....com?acf-cf-customeremail=377&key=6537): failed to open stream: no suitable wrapper could be found in /wp-content/plugins/acf-contact-form-master/acf-contact-process.php on line 63
    
    Warning: Cannot modify header information - headers already sent by (output started at wp-content/plugins/acf-contact-form-master/acf-contact-process.php:63) in /wp-includes/pluggable.php on line 1179
    
    opened by ccbayer 1
  • Major console log issue when including <?php acf_form_head(); ?>

    Major console log issue when including

    Hello,

    When I insert <?php acf_form_head(); ?> I receive these issues in my console log:

    JQMIGRATE: Migrate is installed, version 1.4.1 draggable.min.js?ver=1.11.4:11 Uncaught TypeError: Cannot read property 'mouse' of undefined at draggable.min.js?ver=1.11.4:11 at draggable.min.js?ver=1.11.4:11 at draggable.min.js?ver=1.11.4:11 (anonymous) @ draggable.min.js?ver=1.11.4:11 (anonymous) @ draggable.min.js?ver=1.11.4:11 (anonymous) @ draggable.min.js?ver=1.11.4:11 slider.min.js?ver=1.11.4:11 Uncaught TypeError: Cannot read property 'mouse' of undefined at slider.min.js?ver=1.11.4:11 at slider.min.js?ver=1.11.4:11 at slider.min.js?ver=1.11.4:11 (anonymous) @ slider.min.js?ver=1.11.4:11 (anonymous) @ slider.min.js?ver=1.11.4:11 (anonymous) @ slider.min.js?ver=1.11.4:11 iris.min.js?ver=1.0.7:4 Uncaught TypeError: a.widget is not a function at iris.min.js?ver=1.0.7:4 at iris.min.js?ver=1.0.7:4 (anonymous) @ iris.min.js?ver=1.0.7:4 (anonymous) @ iris.min.js?ver=1.0.7:4 color-picker.min.js?ver=4.7:1 Uncaught TypeError: a.widget is not a function at color-picker.min.js?ver=4.7:1 at color-picker.min.js?ver=4.7:1 (anonymous) @ color-picker.min.js?ver=4.7:1 (anonymous) @ color-picker.min.js?ver=4.7:1 acf-input.min.js?ver=5.5.2:2 Uncaught TypeError: Cannot set property 'locales' of undefined at Object.l10n_v3 (acf-input.min.js?ver=5.5.2:2) at Object.ready (acf-input.min.js?ver=5.5.2:2) at d (acf-input.min.js?ver=5.5.2:1) at Object.i (acf-input.min.js?ver=5.5.2:1) at Object.do_action (acf-input.min.js?ver=5.5.2:1) at HTMLDocument.<anonymous> (acf-input.min.js?ver=5.5.2:1) at i (jquery.js?ver=1.12.4:2) at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2) at Function.ready (jquery.js?ver=1.12.4:2) at HTMLDocument.K (jquery.js?ver=1.12.4:2)

    The form works well, but obviously this is a major concern!

    Kindest regards

    opened by elliottmangham 1
  • Howto let the user decide if a mail copy gets send?

    Howto let the user decide if a mail copy gets send?

    I am trying to add the option to let the user decide wether a mail copy is send or not. In the ACF field group I added a yes/no option called "mail_copy"

    In the acf-contact-process.php file I modified the following part. But since its not working I guess I am overlooking something. Can you help?

    ` //SEND CUSTOMER EMAIL

                    if($form['no_customeremail'] == false OR get_field($form['mail_copy'], $post_id) ) {
    
                        $recipient = (get_field($form['mail_copy'], $post_id))  ? get_field($form['email'], $post_id) : get_field($form['customeremail'], $post_id);
    
                        $cmail = wp_mail($recipient, $customertitle, $customermessage, $headers );
    
                        update_post_meta($post_id, 'customer_email_sent', $cmail); //log whether or not the customer email was sent (1 = success, 0 = failure)
    
                    }
    

    `

    opened by despecial 1
  • "forms" not a valid argument

    After updating the acf-contact-process.php file I got this message.

    Warning: Invalid argument supplied for foreach() in /var/www/XXXX/wp-content/plugins/acf-contact-form-master/acf-contact-process.php on line 110

    Lines 108 - 110: ` $forms = get_field('forms','option');

        foreach($forms as $form) {`
    

    Maybe "forms" is not a sufficient name as option and should be named something like "acf-forms"...

    opened by despecial 1
  • Saving data in fields and showing all fields in the email

    Saving data in fields and showing all fields in the email

    I want to place the form on the WooCommerce my-account page. I did it.

    1. I need, that when filling out the form, the fields are saved and displayed after sending. Each user has his own data in the fields. How can I do that?
    2. The email shows only the completed fields. How do I show all the form fields if they are not filled?
    opened by DmitryShishoff 0
  • Update README.md

    Update README.md

    Made a few grammar corrections, fixed markdown headings not showing correctly on Github, standardized a few items (e.g. where periods appear).

    For periods I used the following rule:

    • For list items, any sentence that stands alone as a list item should not end with a period.
    • For list items, if there are multiple sentences related to a specific list item all but the last sentence end with a period.
    opened by davidshq 0
  • Duplicate emails being sent

    Duplicate emails being sent

    Hi Christine, great plugin!

    I'm having a weird issue where two of each email is being sent - two to the admin and two to the user. Any pointers? Cheers.

    opened by lewisdonovan 1
  • removal of warnings and notices

    removal of warnings and notices

    Hey, just added some checks so that console stays clean ;-) Line 100: $forms = get_field('forms','option'); <- this can be empty (wrapped into an if) Line 200: $class = $field['wrapper']['class']; <- when setting up I don't assign classes to my fields right from the beginning.

    Great extension by the way, it just saved me a few hours ;-)

    opened by funkysoul 0
Releases(0.3)
  • 0.3(Feb 4, 2016)

    This release includes the following new changes:

    • New customer confirmation email
    • Reorganization of form settings into tabs
    • Removal of Submit Text and Return URL fields from form settings (you can now set these values through the shortcode)
    • Expansion of shortcode to include more parameters: form_attributes, html_before_fields, html_after_fields, submit_value, updated_message, label_placement, instruction_placement, field_el, uploader, return (taken from acf_form() function parameters)
    • Generation of random key to hide email rendering template from public
    • Logging of email success or failure on each form submission
    • Admin email field now accepts multiple comma-separated email addresses
    Source code(tar.gz)
    Source code(zip)
Owner
Christine Pham
Christine Pham
Talkino allows you to integrate multi social messengers and contact into your website and enable your users to contact you using multi social messengers' accounts.

Talkino Welcome to our GitHub Repository Talkino is a click to chat plugin to show your agents’ multiple social messengers, phone and emails on the ch

Traxconn 2 Sep 21, 2022
Silverstripe-searchable - Adds to the default Silverstripe search by adding a custom results controller and allowing properly adding custom data objects and custom fields for searching

SilverStripe Searchable Module UPDATE - Full Text Search This module now uses Full Text Support for MySQL/MariaDB databases in version 3.* Adds more c

ilateral 13 Apr 14, 2022
Zem contact reborn - An extensible HTML form mailer plugin for Textpattern CMS.

com_connect Contents Introduction Installing and upgrading Migrating from zem_contact_reborn Usage Tags com_connect tag com_connect_text tag com_conne

Textpattern CMS 23 Dec 8, 2021
The Current US Version of PHP-Nuke Evolution Xtreme v3.0.1b-beta often known as Nuke-Evolution Xtreme. This is a hardened version of PHP-Nuke and is secure and safe. We are currently porting Xtreme over to PHP 8.0.3

2021 Nightly Builds Repository PHP-Nuke Evolution Xtreme Developers TheGhost - Ernest Allen Buffington (Lead Developer) SeaBeast08 - Sebastian Scott B

Ernest Buffington 7 Aug 28, 2022
Ele é voltado para gerar infinitas CC de 23 países A ferramenta ainda esta em BETA então terá muitas Novas atualizações incríveis acompanhem melhor No meu canal do telegram: https://t.me/MS40_canal

BlackBIN ?? ??‍?? Olá pessoal sou eu o maycon ou como vcs me chamam, MS40 ou BLACK_HYDRA. Então esse script foi o um projeto muito antigo Que só esta

BLACK_HYDRA 2 Oct 26, 2022
A package to render form fields in WordPress settings pages.

WP Settings Page Fields A package to render form fields in WordPress settings pages. You might need a settings page with a form and its fields and you

Roel Magdaleno 5 Jul 22, 2022
Magento 2 custom extension to add custom attributes(longitude, latitude) to customer address

Magento 2 custom extension to add custom attributes(longitude, latitude) to customer address. Then save them to quote model and copy them from quote address to order address on bakend, frontend, rest api

MageArab 2 Jul 14, 2022
Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options

Coder Metabox for WordPress Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options. Step 1 call coder-metabox.php file in functi

Ashikur Rahman 3 Feb 19, 2022
Sync Wordpress Pages and Posts (even custom post types + fields) from static Markdown + YAML files

Sync Markdown Files to WordPress Posts and Pages Static site generators let you use a revision-controlled tree of markdown files to make a site, but d

null 26 Sep 26, 2022
COP4331 Class Project 1 - "ConnectUs" virtual contact manager/Rolodex

ConnectUs COP4331 Class Project 1 - "ConnectUs" virtual contact manager/Rolodex Team Members Orion (Project Manager) Eric (Database) Rafael (API/Backe

Orion 3 Dec 9, 2022
Crowdsourced COVID-19 contact tracing

Rastel - crowdsourced COVID-19 contact tracing Why the name? From Latin rastellus, diminuitive of rastrum, "rake", or more precisely "tool of scraping

Liam Walker-Greenough 1 Jan 4, 2022
Contact Form7 - KeepinCRM connector via Webhook

Contact Form7 - KeepinCRM connector Плагін для відправки даних з форм на Contact Form7 до KeepinCRM через Webhook. Встановлення Вивантажити плагін арх

null 1 Aug 11, 2022
A custom twig extension to truncate text while preserving HTML tags.

TwigTruncateExtension A custom twig extension to truncate text while preserving HTML tags. Installation Add the library to your app's composer.json:

dzango 12 Oct 30, 2019
OctoberCMS BlogHub Plugin - Extends RainLab's Blog extension with custom meta details, additional archives and more.

BlogHub extends the RainLab.Blog OctoberCMS plugin with many necessary and helpful features such as Moderatable Comments, Promotable Tags, Custom Meta Fields, additional Archives, basic Statistics, Views counter and more.

rat.md 5 Dec 15, 2022
Magento 2 Extension to cleanup admin menu and Store > Configuration area by arranging third party extension items.

Clean Admin Menu - Magento 2 Extension It will merge all 3rd party extension's menu items in backend's primary menu to a common menu item named "Exten

RedChamps 109 Jan 3, 2023
Magento 2 Blog Extension is a better blog extension for Magento 2 platform. These include all useful features of Wordpress CMS

Magento 2 Blog extension FREE Magento 2 Better Blog by Mageplaza is integrated right into the Magento backend so you can manage your blog and your e-c

Mageplaza 113 Dec 14, 2022
Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.

Repeater Easy Sort Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number o

Robin Sallis 3 Oct 10, 2021
Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values

Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values. Miniset

Jack Sleight 5 Jun 13, 2022
Kirby plugin to visually show hidden characters in all kind of input fields and their previews.

Kirby Hidden Characters Kirby plugin to visually show hidden characters in all kind of input fields and their previews. This includes white spaces and

Jakob Grommas 21 Oct 17, 2022