nf_create_form_listen
Listen for a new form action and create one if necessary.
Description
nf_create_form_listen();
Usage
if ( !function_exists( 'nf_create_form_listen' ) ) { require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/field-settings.php'; } // NOTICE! Understand what this does before running. $result = nf_create_form_listen();
Defined (1)
The function is defined in the following location(s).
- /deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/field-settings.php
- function nf_create_form_listen() {
- $page = isset ( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
- $tab = isset ( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : '';
- $form_id = isset ( $_REQUEST['form_id'] ) ? $_REQUEST['form_id'] : '';
- if ( 'ninja-forms' == $page && 'builder' == $tab && 'new' == $form_id ) {
- $defaults = apply_filters( 'nf_new_form_defaults', array(
- 'clear_complete' => 1,
- 'hide_complete' => 1,
- 'show_title' => 0,
- 'status' => 'new',
- ) );
- $form_id = Ninja_Forms()->form()->create( $defaults );
- $redirect = esc_url_raw( add_query_arg( array( 'form_id' => $form_id ) ) );
- wp_redirect( $redirect );
- die();
- }
- }