Click here to review ยป", null, "no" ); add_option( "acffef/gbut", "Submit", null, "no" ); add_option( "acffef/cpmintegrate", 1, null, "no" ); } if( !is_admin() ){ if(class_exists('acf')) add_action( 'wp_loaded', 'acf_form_head' ); add_action( 'wp_print_styles', array( $this, 'unregisterStyles' ), 100 ); if(get_option("acffef/notification") == 1) add_action( 'notifyACFFE', array( $this, 'sendEmailACF' ) ); add_filter('acf/pre_save_post' , array( $this, 'addNewPost' ) ); } } /** acf-field-group * Setup the things we need in the admin */ public function adminMenu( ) { add_filter( 'manage_edit-acf_columns', array( $this, 'addCustomColumnHeads' ), 20 ); add_action( 'manage_acf_posts_custom_column', array( $this, 'addCustomColumnContents' ), 20, 2 ); add_filter( 'manage_edit-acf-field-group_columns', array( $this, 'addCustomColumnHeads' ), 20 ); add_action( 'manage_acf-field-group_posts_custom_column', array( $this, 'addCustomColumnContents' ), 20, 2 ); $this->pageHook = add_options_page( 'Front End Form Extension for ACF Plugin Settings', 'ACFFEF', 'activate_plugins', 'acffef_menu', array( $this, 'pluginMenuACF' )); add_action( 'admin_print_styles-' . $this->pageHook, function(){ wp_enqueue_style( 'acffef_styles' ); } ); add_action( 'admin_print_styles-' . $this->pageHook, function(){ wp_enqueue_style( 'jquery_ui' ); } ); add_action( 'admin_print_scripts-' . $this->pageHook, function(){ wp_enqueue_script( 'jquery-ui-core' ); } ); add_action( 'admin_print_scripts-' . $this->pageHook, function(){ wp_enqueue_script( 'jquery-ui-accordion' ); } ); add_action('load-'.$this->pageHook, array($this, 'onLoadPage')); add_filter('screen_layout_columns', array($this, 'on_screen_layout_columns'), 10, 2); } //for WordPress 2.8 we have to tell, that we support 2 columns ! function on_screen_layout_columns($columns, $screen) { if ($screen == $this->pageHook) { $columns[$this->pageHook] = 2; } return $columns; } public function onLoadPage() { wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); add_meta_box('acffef_free_settings_meta_box_id', 'Front End Form Extension for ACF Settings', array($this, 'acffef_free_settings_meta_box_container'), $this->pageHook, 'normal', 'core', null); add_meta_box( 'plugin_info_meta_box_id', 'About WPPluginCo.com', array($this, 'plugin_info_meta_box_container'), $this->pageHook, 'side', 'core', null ); add_meta_box('other_plugins_meta_box_id', 'Other Plugins by WPPluginCo.com', array($this, 'other_plugins_info_meta_box_container'), $this->pageHook, 'side', 'core', null); add_meta_box('related_plugins_meta_box_id', 'Related Plugins', array($this, 'related_plugins_info_meta_box_container'), $this->pageHook, 'side', 'core', null); } public function adminNotices( ) { wp_register_style( 'acffef_styles', plugins_url( '../assets/css/acf.css', __FILE__) ); wp_register_style( 'jquery_ui', plugins_url( '../assets/css/jquery-ui.css', __FILE__) ); if ( (!acffef_dependency_active('cpt-ui') || !acffef_dependency_active('acf')) && !get_user_meta(get_current_user_id(), 'ACF_Frontend_Form_extension_admin_notice_cancelled', true) ) { $notice_message = ''; ?>

Front End Form Extension for ACF requires that you install and activate all of these plugins: Custom Post Type UI Plugin
'; ?> Advanced Custom Fields"; ?>

If these plugin(s) are installed please activate them here

To use Front End Form Extension for ACF you must install the Custom Post Type UI Plugin'?>. If you don't understand why then just trust us. :) If you do understand why and just want to use a different Plugin you can skip this but we don't recommend it.

cpmIntegration = true; } else { $this->cpmIntegration = false; update_option( "acffef/cpmintegrate", 0 ); } if ( acffef_dependency_active('acffef-premium') ) $this->premium = true; } /* * */ public function removeAdminNotice() { update_user_meta(get_current_user_id(), 'ACF_Frontend_Form_extension_admin_notice_cancelled', true); return; } public function loadScript() { wp_enqueue_script('remove-notice', plugins_url('js/remove.js', __FILE__), array('jquery', 'common'), false, true); wp_localize_script( 'remove-notice', 'remove', array( 'nonce' => wp_create_nonce( 'remove' ), ) ); } /** * Displays the custom column head * @param Array $columns List of table heads */ public function addCustomColumnHeads( $columns ) { $neworder = array( ); foreach( $columns as $id => $name ) { $neworder[ $id ] = $name; if( $id == 'cb' ) { $neworder[ 'id' ] = 'Group ID'; $neworder[ 'sc' ] = 'Short Code'; } } return $neworder; } /** * Displays the custom column content * @param String $name * @param Integer $id */ public function addCustomColumnContents( $name, $id ) { if( $name == 'id' ) { echo $id; } if( $name == 'sc' ) { echo '[acf_form group_id="'.$id.'" create_new_post="true" post_type="example-type"]'; } } /** * Unregister unnecessary styles that breaks the form */ public function unregisterStyles( ) { wp_deregister_style( 'wp-admin' ); } /** * Generate Shortcodes for each field */ public function generate_scodes( $atts ) { $atts = shortcode_atts( array( 'field_name' => "", 'val' => $this->val ), $atts ); $fn = $atts['field_name']; return $atts['val'][$fn]; // return print_r($atts['val']); //return "tx a lot"; } /** * Display an acf form * @param Array $atts List of Shortcode Attributes * @return String HTML string */ /** * [Edited] Modified ACF Form to create a new post once the form is submitted. */ public function displayForm( $atts ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); ob_start( ); $atts = shortcode_atts( array( 'group_id' => "", 'create_new_post' => "false", 'post_type' => "post" ), $atts ); $groups = explode( ",", $atts[ 'group_id' ] ); $groups = array_map( 'trim', $groups ); if ( acffef_dependency_active('acffef-premium')) { $options = array( 'field_groups' => $groups, ); if(strlen(get_option("acffef/but-$groups[0]")) > 0) $options['submit_value'] = get_option("acffef/but-$groups[0]"); else $options['submit_value'] = get_option("acffef/gbut"); if(strlen(get_option("acffef/umessages-$groups[0]")) > 0) $options['updated_message'] = get_option("acffef/umessages-$groups[0]"); else $options['updated_message'] = get_option("acffef/update_message"); } else $options = array( 'field_groups' => $groups, 'submit_value' => 'Submit', 'updated_message' => stripslashes(get_option("acffef/update_message")), ); if(strtolower($atts[ 'create_new_post' ]) == "true") $options = array_merge(array('post_id' => "new-".$atts[ 'post_type' ]), $options); $options['form_attributes']['enctype'] = 'multipart/form-data'; // Set a form ID $options['form_attributes']['id'] = 'acffef_' . $atts['group_id']; $options['updated_message'] = '
' . $options['updated_message'] . '
'; $return_link = add_query_arg( 'submitted', 'form-' . $atts['group_id'], "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ); $return_link = add_query_arg( 'updated', 'true', $return_link ); $options['return'] = $return_link; acf_form($options); wp_enqueue_script( 'custom-script', plugins_url('../assets/js/custom_script.js', __FILE__), array( 'jquery' ) ); return ob_get_clean( ); } public function addNewPost( $post_id ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); global $wpdb; $temppost_id = $post_id; $post_id = explode( "-", $post_id); if( $post_id[0] != 'new' ) return $post_id; if( count($post_id) > 2 ){ array_shift( $post_id ); $post_id[1] = implode( "-",$post_id ); } $iterable_fields = array(); if ( acffef_dependency_active('acf-pro') ) { $iterable_fields = $_POST['acf']; } else { $iterable_fields = $_POST['fields']; } foreach($iterable_fields as $key => $value) { $currentacf = $key; // Get fields and make their shortcodes if ( acffef_dependency_active('acffef-premium') ) { $t = get_field_object($key); add_shortcode( 'acffef', array( $this, 'generate_scodes' ) ); $this->val[$t['name']] = $value; } } if ( acffef_dependency_active('acf-pro') ) { $currentacf = $GLOBALS['acf_form']['field_groups'][0]; } $sql_query = " SELECT $wpdb->postmeta.post_id FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = '$currentacf' "; $results = $wpdb->get_results($sql_query, ARRAY_A); if ( acffef_dependency_active('acf-pro') ) { $this->acfdisplay = $GLOBALS['acf_form']['field_groups'][0]; } else { $this->acfdisplay = $results[0]["post_id"]; } $subject = get_option("acffef/subject"); // Form specific post title $custom_post_title = apply_filters( 'acffef_premium/replace_fieldcodes', get_option("acffef/post-title-" . $this->acfdisplay) ); // Get fields shortcode and use that in title if ( acffef_dependency_active('acffef-premium') ) { $subject = stripslashes_deep($subject); if (strpos($subject,'field_name') !== false) { $subject = do_shortcode( $subject ); } } $post = array( 'post_status' => 'publish', 'post_title' => ($custom_post_title == '' ? $subject : $custom_post_title), 'post_type' => $post_id[1] ); $post_type = $post_id[1]; $post_id = wp_insert_post( $post ); $_POST['return'] = add_query_arg( array('post_id' => $post_id, '?' => '#message'), $_POST['return'] ); do_action( 'notifyACFFE' ); /* * Integration with Project Manager */ if(get_option("acffef/cpmintegrate") == 1) { $quickQuery = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_name = %s AND post_type = project', sanitize_title_with_dashes($post_type)); $projectID = $wpdb->get_var( $quickQuery ); $cpmController = new CPM_Project(); $_POST['project_name'] = ucwords($post_type); $_POST['project_description'] = "Automatically created by Front End Form Extension for ACF"; if ( empty($projectID) ) $projectID = $cpmController->create(); $cpmController = new CPM_Task(); $_POST['tasklist_name'] = "Support Requests"; $_POST['tasklist_detail'] = "Automatically created by Front End Form Extension for ACF"; $cpmController->add_list($projectID); } return $post_id; } public function sendEmailACF( ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); //$to = get_option("acffef/to"); add_filter( 'wp_mail_content_type', function($content_type){ return 'text/html'; }); $to = explode(',', get_option("acffef/to")); $subject = get_option("acffef/subject"); // If email subject has shortcode then use it in email subject if ( acffef_dependency_active('acffef-premium') ) { if (strpos($subject,'field_name') !== false) { $subject = do_shortcode( $subject ); } } if ( acffef_dependency_active('acffef-premium') ) { if(strlen(get_option("acffef/recp-".$this->acfdisplay))>0) $to = explode(',', get_option("acffef/recp-".$this->acfdisplay)); if(strlen(get_option("acffef/subj-".$this->acfdisplay))>0) $subject =get_option("acffef/subj-".$this->acfdisplay); if(strlen(get_option("acffef/messages-".$this->acfdisplay))>0){ $message = ''; if (strpos($message,'field_name') !== false) { $pattern = get_shortcode_regex(); $msg = stripslashes_deep($message); preg_match_all('/'.$pattern.'/uis', $msg, $matches); $message = strip_shortcodes( $message ); foreach($matches[0] as $vals) {$message .= '
'.do_shortcode( stripslashes_deep($vals) );} } else { // ACF Pro specific setting if ( acffef_dependency_active('acf-pro') ) { $iterable_fields = $_POST['acf']; } else { $iterable_fields = $_POST['fields']; } foreach( $iterable_fields as $k => $v ) { if(!empty($v)){ $fo = get_field_object($k); if($v && is_array($v)) { $message .= ''; foreach( $v as $vk => $vv ){ if($v && is_array($v)) { foreach( $vv as $vvk => $vvv ){ $message .= ''; } } else $message .= ''; } $message .= ''; } else $message .= ''; } } } $message .= '
'; $message .= ''.get_option("acffef/messages-".$this->acfdisplay).'';//implode('-',$_POST['fields']); $message .= '
 
'.$fo['label'].''.$vvv.'
'.$fo['label'].''.$vv.'
'.$fo['label'].''.$v.'
'; } else $message = get_option("acffef/message"); } else $message = get_option("acffef/message"); if ( acffef_dependency_active('acffef-premium') ) { if (strpos($message,'field_name') !== false) { $pattern = get_shortcode_regex(); $msg = stripslashes_deep($message); preg_match_all('/'.$pattern.'/uis', $msg, $matches); $message = strip_shortcodes( $message ); $message .= '
'.do_shortcode( stripslashes_deep($matches[0][0]) ); $message .= '
'.do_shortcode( stripslashes_deep($matches[0][1]) ); } } add_filter( 'wp_mail_content_type', function($content_type){ return 'text/html'; }); $emails_address_list = array(); foreach($to as $to_email_address) { $to_email_address = trim($to_email_address); $emails_address_list[] = $to_email_address; } // Parse field codes inserted via email configuration if ( acffef_dependency_active('acffef-premium') ) { $message = apply_filters( 'acffef_premium/replace_fieldcodes', $message); $subject = apply_filters( 'acffef_premium/replace_fieldcodes', $subject); } wp_mail($emails_address_list, $subject, $message ); remove_filter( 'wp_mail_content_type', function($content_type){ return 'text/html'; }); } public function pluginMenuACF( ) { global $screen_layout_columns; foreach($_POST as $key => $value) if($key != "acffef/notification") { update_option($key, $value); if(isset( $_POST["acffef/notification"] )) update_option("acffef/notification", 1); else update_option("acffef/notification", 0); if(isset( $_POST["acffef/cpmintegrate"] )) update_option("acffef/cpmintegrate", 1); else update_option("acffef/cpmintegrate", 0); } ?>

Front End Form Extension for ACF Settings

pageHook, 'normal', ''); ?>
pageHook, 'side', ''); ?>
'https://wordpress.org/plugins/bulk-photo-to-product-importer-extension-for-woocommerce/', 'Premium Bulk Photo To Product Importer Extension For WooCommerce' => 'https://www.wppluginco.com/product/premium-bulk-photo-to-product-importer-extension-for-woocommerce', 'ACF Front End Form Plugin' => 'https://www.wppluginco.com/product/acf-front-end-form-plugin', 'CRM Plugin For Wordpress' => 'https://www.wppluginco.com/product/crm-plugin-for-wordpress', 'Custom Pointers Plugin For Wordpress' => 'https://www.wppluginco.com/product/custom-pointers-plugin-for-wordpress' ); ?>
This Plugin was created by WP Plugin Co. and you can find more of our Plugins, or request a custom one, here .
'https://wordpress.org/plugins/bulk-photo-to-product-importer-extension-for-woocommerce/', 'Premium Bulk Photo To Product Importer Extension For WooCommerce' => 'https://www.wppluginco.com/product/premium-bulk-photo-to-product-importer-extension-for-woocommerce', 'ACF Front End Form Plugin' => 'https://www.wppluginco.com/product/acf-front-end-form-plugin', 'CRM Plugin For Wordpress' => 'https://www.wppluginco.com/product/crm-plugin-for-wordpress', 'Custom Pointers Plugin For Wordpress' => 'https://www.wppluginco.com/product/custom-pointers-plugin-for-wordpress' ); ?>
0) { ?>
    $link) { ?>
0) { ?>
    $link) { ?>
premium != true ) { ?> cpmIntegration == true) { ?>
General Message to be displayed after submitting the form. "acffef/update_message", "media_buttons" => false, "teeny" => true, "textarea_rows" => 5) ); ?>
Activate Integration with Project Manager. When this is activated a Task will be created, in the Project Manager. It will be added to a Task List called 'Support Requests' or create one if it doesn't already exist. It will be added to the Project that is based on the ACF Field you specified in Settings.
Send an email notification with data records once form has been updated.
premium != true ) { ?>
Email Settings
Send to whom? "> Use comma to separate multiple emails
Email Subject ">
premium == true ) echo "Individual Settings"; else echo "Email Message"; ?> premium == true ){ do_action("acffe_premium_groupmessage"); } else{ ?> "acffef/message", "media_buttons" => false, "teeny" => true, "textarea_rows" => 5) ); ?>