Delete Entry Data after Submission

Delete Entry Data after Submission

By default, Gravity Forms was designed to record all data submitted to it, so there isn』t an override to stop Gravity Forms from storing entry data upon submission. The reason for this is the entry must be saved so the data is available when notifications are sent and feed based add-ons, like PayPal and User Registration, are processed.
That said, Gravity Forms 2.4 did introduce Personal Data Settings which include the ablity to enable automatic deletion of entries after a specified number of days.
Bear in mind when entries are deleted, files associated with the entry are also deleted. If you want to keep the files, use the gform_field_types_delete_files filter.
There are also a number of third-party add-ons which can be used to delete entries either as the form submission ends or at a scheduled date/time:

Gravity Flow
Entry Automation by ForGravity
Gravity Perks – Disable Entry Creation by Gravity Wiz
Gravity Forms Encrypted Fields by PluginOwl
Gravity Forms Utility by Gravity+
Wider Gravity Forms Stop Entries by Jonny Allbut

If you would prefer not to use one of the above solutions you can use custom code in the theme functions.php file or a custom functionality plugin that will wait until the data is recorded, and then go in and remove the entry that was just created. To do so, you would use the following code which works with Gravity Forms 1.8 and newer:
123456// Target submissions from form ID  1.// Change gform_after_submission_1 to reflect your target form ID, or use gform_after_submission to target all forms.add_action( 'gform_after_submission_1', 'remove_form_entry' );function remove_form_entry( $entry ) {    GFAPI::delete_entry( $entry['id'] );}
The following code is applicable to Gravity Forms 1.7 and earlier only.
123456789101112131415161718192021222324252627282930add_action('gform_after_submission_1', 'remove_form_entry', 10, 2);function remove_form_entry($entry, $form){    global $wpdb;     $lead_id = $entry['id'];    $lead_table = RGFormsModel::get_lead_table_name();    $lead_notes_table = RGFormsModel::get_lead_notes_table_name();    $lead_detail_table = RGFormsModel::get_lead_details_table_name();    $lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();     //Delete from detail long    $sql = $wpdb->prepare(" DELETE FROM $lead_detail_long_table                            WHERE lead_detail_id IN(                                SELECT id FROM $lead_detail_table WHERE lead_id=%d                            )", $lead_id);    $wpdb->query($sql);     //Delete from lead details    $sql = $wpdb->prepare("DELETE FROM $lead_detail_table WHERE lead_id=%d", $lead_id);    $wpdb->query($sql);     //Delete from lead notes    $sql = $wpdb->prepare("DELETE FROM $lead_notes_table WHERE lead_id=%d", $lead_id);    $wpdb->query($sql);     //Delete from lead    $sql = $wpdb->prepare("DELETE FROM $lead_table WHERE id=%d", $lead_id);    $wpdb->query($sql); }
The expected behavior would be that the entry would not exist in the Gravity Forms database tables after submission. If you are having issues with this script, please read up on our gform_after_submission hook.

Defining Minimum Add-On Requirements

Defining Minimum Add-On Requirements

WordPress RequirementsWordPress VersionWordPress PluginsPlugin NamePHP RequirementsPHP VersionExtensionsExtension VersionFunctionsGravity Forms RequirementsGravity Forms Add-OnsAdd-On NameAdd-On VersionCustom Requirements

As of Gravity Forms 2.2, add-ons can now easily define requirements that are needed before the add-on can be used. Defining requirements is as simple as overriding the minimum_requirements function in the GFAddOn class.
1234567891011class Example_AddOn extends GFAddOn {     public function minimum_requirements() {        return array(            'wordpress' => array(                'version' => '4.6.2',            )        );    } }
WordPress Requirements
Using the wordpress array key, requirements based on the WordPress installation can be defined.
12345array(    'wordpress' => array(        // WordPress-related requirements go here.    ))
WordPress Version
Within the wordpress requirement, the version key can be used to define a specific WordPress version to be used as a minimum requirement. Versions higher than this number will succeed, while lower versions will fail.
12345array(    'wordpress' => array(        'version' => '4.6.2'    ))
WordPress Plugins
12345array(    'plugins' => array(        'rest-api/plugin.php',    ),)
Plugin Name
12345array(    'plugins' => array(        'jetpack/jetpack.php' => 'Jetpack by WordPress.com',    ),)
PHP Requirements
Requirements related to PHP versions, extensions, or even available functions can be defined by using the php array key.
12345array(    'php' => array(        // PHP-related requirements go here.    ))
PHP Version
12345array(    'php' => array(        'version' => '5.6',    ))
Extensions
1234567array(    'php' => array(        'extensions' => array(            'curl',        ),    ),)
Extension Version
123456789array(    'php' => array(        'extensions' => array(            'curl' => array(                'version' => '1.0',            ),        ),    ),)
Functions
1234567array(    'php' => array(        'functions' => array(            'openssl_random_pseudo_bytes',        ),    ),)
Gravity Forms Requirements
Gravity Forms Add-Ons
12345array(    'add-ons' => array(        'gravityformsmailchimp',    ),)
Add-On Name
1234567array(    'add-ons' => array(        'gravityformsstripe' => array(            'name' => 'Gravity Forms Stripe Add-On',        ),    ),)
Add-On Version
1234567array(    'add-ons' => array(        'gravityformspaypal' => array(            'version' => '5.0',        ),    ),)
Custom Requirements
123array(    array( $this, 'custom_requirement_callback' ),)

Date

Date

SummaryCommon SettingsGeneral SettingsMerge TagsUsageModifiers

Summary

The Date field allows you to present a field that captures date data using the jQuery UI date picker. It is available under the Advanced Fields section within the form editor.

Date field as displayed in the Field Library

Date field as displayed in the Form Editor.

Common Settings

This field uses only common field settings for the Appearance and Advanced settings. For a description of each of the common field settings, refer to this article. Below you will find description of specialty settings that are particular to this field.

General Settings

SettingDescriptionDate Input TypeDate Picker will let users select a date from a calendar.Date Field will let users free type the date.Date Drop Down will let users select date from drop downs.IconAllows you to set an icon which will be listed beside the date field. Options include: No Icon, Calendar Icon, Custom IconDate FormatSelect the format you would like to use for the date input. Available options are MM/DD/YYYY and DD/MM/YYYY.

Merge Tags

For more information on the use of merge tags, refer to these articles.

Usage

{Field Name:2:modifier}

Notes:

The field name is optional.The second parameter defines the ID of the field that will be output in this tag.Within the third parameter, you can define an optional modifier to use. Only one modifier can be used per merge tag.

Modifiers

ModifierDescription:yearOutputs only the year used in the field.:monthOutputs only the month used in the field.:dayOutputs only the day used in the field.:ymdOutputs the date formatted as year/month/day. Example: 2016/10/31.:dmyOutputs the date formatted as day/month/year. Example: 31/10/2016.

Date Field CSS Selectors

Date Field CSS Selectors

Date Picker Input TypeInput FieldIcon ImageDate Field Input TypeMonthContainerInput FieldSub-LabelDayContainerInput FieldSub-LabelYearContainerInput FieldSub-Label

Date Picker Input Type
Input Field

example: date – input field (input) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .datepicker {border: 1px solid red}

example: date – input field (input) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .datepicker {border: 1px solid red}

example: date – input field (input) – applies just to specific date field input (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .datepicker {border: 1px solid red}

Icon Image

example: date – icon image (img) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_input_datepicker_icon {border: 1px solid red}

example: date – icon image (img) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_input_datepicker_icon {border: 1px solid red}

example: date – icon image (img) – applies just to specific date field input (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_input_datepicker_icon {border: 1px solid red}

Date Field Input Type
Month
Container
Contains the month input field and sub-label

example: date – month container (div) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_month {border: 1px solid red}

example: date – month container (div) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_month {border: 1px solid red}

example: date – month container (div) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_month {border: 1px solid red}

Input Field

example: date – month input field (input) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_month input {border: 1px solid red}

example: date – month input field (input) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_month input {border: 1px solid red}

example: date – month input field (input) – applies just to specific form field (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_month input {border: 1px solid red}

Sub-Label

example: date – month sub-label (label) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_month label {color: red}

example: date – month sub-label (label) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_month label {color: red}

example: date – month sub-label (label) – applies just to specific sub-label (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_month label {color: red}

Day
Container
Contains the day input field and sub-label

example: date – day container (div) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_day {border: 1px solid red}

example: date – day container (div) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_day {border: 1px solid red}

example: date – day container (div) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_day {border: 1px solid red}

Input Field

example: date – day input field (input) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_day input {border: 1px solid red}

example: date – day input field (input) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_day input {border: 1px solid red}

example: date – day input field (input) – applies just to specific form field (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_day input {border: 1px solid red}

Sub-Label

example: date – day sub-label (label) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_day label {color: red}

example: date – sub-label (label) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_day label {color: red}

example: date – sub-label (label) – applies just to specific sub-label (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_day label {color: red}

Year
Container
Contains the month input field and sub-label

example: date – year container (div) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_year {border: 1px solid red}

example: date – year container (div) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_year {border: 1px solid red}

example: date – year container (div) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_year {border: 1px solid red}

Input Field

example: date – year input field (input) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_year input {border: 1px solid red}

example: date – year input field (input) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_year input {border: 1px solid red}

example: date – year input field (input) – applies just to specific form field (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_year input {border: 1px solid red}

Sub-Label

example: date – year sub-label (label) – applies to all forms
body .gform_wrapper .gform_body .gform_fields .gfield .gfield_date_year label {color: red}

example: date – year sub-label (label) – applies just to form ID #1
body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_date_year label {color: red}

example: date – year sub-label (label) – applies just to specific sub-label (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_date_year label {color: red}

Database Structure

Database Structure

Tableswp_gf_addon_feedwp_gf_addon_payment_callbackwp_gf_addon_payment_transactionwp_gf_draft_submissionswp_gf_entrywp_gf_entry_metawp_gf_entry_noteswp_gf_formwp_gf_form_metawp_gf_form_viewChanges from Gravity Forms 2.2IntroductionChangesThe Migration Process

Here』s how Gravity Forms is structured within your database:

Note: This structure applies to Gravity Forms version 2.3 or higher.

Tables
wp_gf_addon_feed
Contains Gravity Forms feeds.

id
Contains the unique feed ID.
form_id
Contains the ID of the form that the feed is associated with.
is_active
Defines if the feed is active or not. Integer is used as a boolean (0 is false, 1 is true).
feed_order
The order in which the feed is processed if multiple feeds exist.
meta
Meta information related to the feed. Stored as JSON.
addon_slug
The slug of the add-on that the feed is associated with.

wp_gf_addon_payment_callback
Contains information related to payment callbacks that have been received.

id
The row ID.
lead_id
The entry ID associated with the callback.
addon_slug
The add-on associated with the callback.
callback_id
The callback ID.
date_created
The date that the callback was received.

wp_gf_addon_payment_transaction
Contains transaction details.

id
The transaction ID.
lead_id
The entry ID associated with the transaction.
transaction_type
The transaction type.
transaction_id
The unique transaction ID.
subscription_id
The subscription ID, if applicable.
is_recurring
Defines if this is a recurring subscription. Integer is used as a boolean (0 is false, 1 is true).
amount
The amount of the transaction.
date_created
The date the transaction was created.

wp_gf_draft_submissions
Holds draft submissions created by the save and continue feature.

uuid
The unique ID of the draft submission.
email
The email address associated with the draft submission.
form_id
The form ID that the draft submission is associated with.
date_created
The date the draft submission was created.
ip
The IP address that created the draft submission.
source_url
The URL that was used to submit the draft submission.
submission
Submission details regarding the draft submission.

wp_gf_entry
Contains Gravity Forms entries.

id
The unique entry ID.
form_id
The form ID that the entry is associated with.
post_id
The ID of the post that was created from the entry, if applicable.
date_created
The date that the entry was created.
date_updated
The date that the entry was last updated.
is_starred
If the entry is starred. Integer is used as a boolean (0 is false, 1 is true).
is_read
If the entry has been marked as read. Integer is used as a boolean (0 is false, 1 is true).
ip
The IP address that submitted the entry.
source_url
The URL of where the submission took place.
user_agent
The user agent of the entry submitter.
currency
The currency used in the entry, if applicable.
payment_status
The status of the payment, if applicable.
payment_date
The date that the payment took place, if applicable.
payment_amount
The amount of the payment, if applicable.
payment_method
The transaction method used to process the payment, if applicable.
transaction_id
The transaction ID associated with the entry, if applicable.
is_fulfilled
If the transaction has been fulfilled, if applicable.
created_by
The ID of the user that created the entry, if applicable.
transaction_type
The transaction type, if applicable.
status
The current entry status.

wp_gf_entry_meta
Contains additional metadata related to entries. Details from fields as well as add-ons are stored here.

id
The unique ID.
form_id
The form ID that the entry meta is associated with.
entry_id
The entry ID that the meta is associated with.
meta_key
The meta key.
meta_value
The value stored under the meta key.
item_index
The item index.

wp_gf_entry_notes
Contains notes that were placed on an entry.

id
The note ID.
entry_id
The entry ID that the note is associated with.
user_name
The user name that created the note.
user_id
The user ID that created the note.
date_created
The date that the note was created.
value
The contents of the note.
note_type
The type of note that was left, if applicable.
sub_type
The secondary note type, if applicable.

wp_gf_form
Contains the forms that exist within Gravity Forms.

id
The form ID.
title
The form title.
date_created
The date that the form was created.
is_active
If the form is active. Integer is used as a boolean (0 is false, 1 is true).
is_trash
If the form is trashed. Integer is used as a boolean (0 is false, 1 is true).

wp_gf_form_meta
Contains metadata associated with forms.

form_id
The form ID that the metadata is associated with.
display_meta
Meta related to how the form and fields are configured.
entries_grid_meta
Additional meta related to entries and how they will be displayed.
confirmations
Confirmation configuration.
notifications
Notification configuration.

wp_gf_form_view
Contains details on form views.

id
The ID.
form_id
The form ID that the data is associated with.
date_created
The date that the row was created.
ip
The IP that accessed the form.
count
The number of times that the IP accessed the form.

Changes from Gravity Forms 2.2
Introduction
The database schema was changed in Gravity Forms 2.3 to enable significant performance enhancements and to allow key features to be added. Code that uses the Gravity Forms API (GFAPI) will not be affected and will continue to work as before. However, custom code and add-ons that access the database tables directly will need updating.
Changes
The following changes were made to the tables and columns.

rg_lead -> gf_entry
rg_lead_details + rg_lead_meta tables -> gf_entry_meta
All lead_id columns -> entry_id
rg_form -> gf_form
rg_form_view -> gf_form_view
rg_form_meta -> gf_form_meta
rg_incomplete_submissions -> gf_draft_submissions

Note: Despite of tables gf_addon_feed, gf_addon_payment_callback and gf_addon_payment_transaction are using the gf_ prefix, they』re not part of the changes done in this version. If for any reason you need to delete the new tables to run the upgrade from scratch again, make sure to skip these tables.

The Migration Process
The automatic migration process creates the new tables and copies all the data over to the new tables in a series of background tasks. If the task stops, for example, due to a server restart then the migration will continue with a scheduled cron task. If there』s a database error then the migration will stop and try again later.

Dashboard Widget

Dashboard Widget

The dashboard widget is installed automatically when you activate Gravity Forms and can be accessed from the WordPress dashboard.
This widget provides you with some basic information about the forms you have created. You can quickly see which forms have unread entries, how many unread entries, and the total number of entries on a form by form basis.
Clicking the form name or the number of entries will take you to the entry screen for that form. The dashboard widget shows unread entries and total entries.
You may hide the dashboard widget by editing your Screen Options for the Dashboard.

Customizing The Login Form Template

Customizing The Login Form Template

Placing Template FilesCustomizing Template Filesgravityformsuserregistration-login.php examplegravityformsuserregistration-loggedin.php example

If you』re using the Gravity Forms login form but want to use a custom template, you can easily do so. This is especially helpful for theme developers who want to utilize the existing login form already built into Gravity Forms.
Placing Template Files
The Gravity Forms login form can be customized by placing template files directly within your active theme. If the login form is being loaded, Gravity Forms will automatically load those template files when needed. Here are the files it will look for:

gravityformsuserregistration-login.php
This template file is loaded when the login form is displayed, and the user is not logged in.
gravityformsuserregistration-loggedin.php
If the user is already logged in, this template will be loaded.

Both of these files will need to be placed in the top-level of your active theme. Outside of placing the files there, no additional configuration is needed. If the file exists, it will be used.
Customizing Template Files
When using these custom template files, the sky is the limit! Inside the template, you can load any code or output any markup that you need.
Keep in mind that these files will override the default markup automatically even if they』re blank, so be sure to include things like username and password fields if you still need to use them.
To help you start below you can find example content for both files that reproduce the default markup.
gravityformsuserregistration-login.php example
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081// Just a title to let you know the custom template is being loaded. Remove before going live.echo '

This is my custom Login Form - Not logged template

'; extract( $args ); /* Get the login form. */$form = GF_User_Registration::login_form_object(); /* Set the tab index. */GFCommon::$tab_index = gf_apply_filters( array( 'gform_tabindex', $form['id'] ), $tabindex, $form ); /* Enqueue needed scripts. */GFFormDisplay::enqueue_form_scripts( $form, false ); /* Prepare the form wrapper class. */$wrapper_css_class = GFCommon::get_browser_class() . ' gform_wrapper'; /* Ensure login redirect URL isn't empty. */if ( rgblank( $login_redirect ) ) {    $login_redirect = ( isset( $_SERVER['HTTPS'] ) ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];} /* Open Gravity Form wrapper and form tag. */$html  = "

'; /* Display links. */if ( ! empty( $logged_out_links ) ) {         if ( GF_User_Registration::get_plugin_setting( 'custom_registration_page_enable' ) == '1' ) {        $registration_page = GF_User_Registration::get_plugin_setting( 'custom_registration_page' );        $register_url      = 'gf_custom' === $registration_page ? GF_User_Registration::get_plugin_setting( 'custom_registration_page_custom' ) : get_permalink( $registration_page );    } else {        $register_url = wp_registration_url();    }     $html .= '

';     } echo $html;
gravityformsuserregistration-loggedin.php example
1234567891011121314151617181920212223242526272829303132333435// Just a title to let you know the custom template is being loaded. Remove before going live.echo '

This is my custom Login Form - Logged in template

'; /* Prepare the logged in message. */if ( rgblank( $logged_in_message ) ) {    $logged_in_message = sprintf(        esc_html__( 'You are currently logged in as %s%s%s. %sLog out?%s', 'gravityformsuserregistration' ),        '', $current_user->display_name, '',        '', ''    );} else {    $logged_in_message = str_replace( '{logout_url}', '' . esc_html__( 'Logout', 'gravityformsuserregistration' ) . '', $logged_in_message );    $logged_in_message = GFCommon::replace_variables( $logged_in_message, array(), array(), false, false, false, 'text' );} /* Display the avatar and logged in message. */$html  = '

';$html .= filter_var( $logged_in_avatar, FILTER_VALIDATE_BOOLEAN ) ? get_avatar( $current_user->ID ) . '
' : null;$html .= $logged_in_message;$html .= '

'; /* Display links. */if ( ! empty( $logged_in_links ) ) {         foreach ( $logged_in_links as $link ) {                 $link['url']  = str_replace( '{logout_url}', esc_attr( wp_logout_url( $logout_redirect ) ), $link['url'] );        $link['url']  = GFCommon::replace_variables( $link['url'], array(), array(), false, false, false, 'text' );        $html        .= '' . esc_html( $link['text'] ) . '
';             }     } echo $html;

Custom Logging Statements

Custom Logging Statements

IntroductionLogging evaluation of conditional logicLogging field validation errorsLogging saved valuesWriting to the core logWriting to the add-on log

Note: As of Gravity Forms 2.4, the following non-dismissible notice will be displayed on every WordPress admin page when logging is enabled:

Refer to our Logging and Debugging article for more information.
Introduction
While Gravity Forms and its add-ons include numerous logging statements sometimes you may need to add more. For example, standard logging statements don』t include the evaluation of conditional logic rules or field validation failures.
Find out how to enable logging with Gravity Forms 2.2+ in the Logging and Debugging article, older versions of Gravity Forms would require the Logging Add-On.
Logging evaluation of conditional logic
If you are having an issue with notifications not being sent due to the conditional logic rules not being met you can see exactly how the conditional logic rule is configured and what the actual field value was by using the gform_is_value_match hook in your theme functions.php file.
12345678add_filter( 'gform_is_value_match', 'log_conditional_logic_evaluation', 20, 6 );function log_conditional_logic_evaluation( $is_match, $field_value, $target_value, $operation, $source_field, $rule ) {    GFCommon::log_debug( 'gform_is_value_match: $rule => ' . print_r( $rule, 1 ) );    GFCommon::log_debug( 'gform_is_value_match: $field_value => ' . print_r( $field_value, 1 ) );    GFCommon::log_debug( 'gform_is_value_match: $is_match => ' . var_export( $is_match, 1 ) );     return $is_match;}
Logging field validation errors
Field validation failures can be logged using the gform_validation hook in your theme functions.php file.
1234567891011add_filter( 'gform_validation', 'log_validation_errors', 50 );function log_validation_errors( $validation_result ) {    $form = $validation_result['form'];    foreach ( $form['fields'] as $field ) {        if ( $field->failed_validation ) {            GFCommon::log_error( "form #{$form['id']}: validate() - failed: {$field->label}({$field->id} - {$field->type}) - message: {$field->validation_message}" );        }    }     return $validation_result;}
Logging saved values
Values being saved can be logged using the gform_save_field_value hook in your theme functions.php file.
12345678910add_filter( 'gform_save_field_value', 'log_saved_values', 50, 5 );function log_saved_values( $value, $entry, $field, $form, $input_id ) {     $input_name = 'input_' . str_replace( '.', '_', $input_id );     GFCommon::log_debug( "log_save_field_value: Input ID: {$input_id}. POST value => " . print_r( rgpost( $input_name ), true ) );    GFCommon::log_debug( 'log_save_field_value: Saved value => ' . print_r( $value, true ) );     return $value;}
Writing to the core log
To add a simple custom logging statement to your own code which will save to the core log you use the following:
1GFCommon::log_debug( __METHOD__ . '(): running.' );
To also include a variable which contains a string in the logging statement you could do this:
1GFCommon::log_debug( __METHOD__ . "(): Nothing to do for the {$event} event." );
If you wanted to output another type of variable such as an array you could use the following:
1GFCommon::log_debug( __METHOD__ . '(): form => ' . print_r( $form, true ) );
Writing to the add-on log
If you are creating your own add-on which uses the Add-on Framework you can use the following to write the logging statement to the log file for the add-on:
1$this->log_debug( __METHOD__ . '(): feed => ' . print_r( $feed, true ) );
__METHOD__ is a PHP constant, it will be replaced with the class method name. You could remove that and include the function name or some other identifier in the logging statement itself.

Create a Custom Field

Create a Custom Field

IntroductionExamples

Introduction
When using the Settings API you can define a custom field type by creating a function called settings_{your_custom_field_type}. The text after the first underscore will be what you decided to name your type. The function will run for every field of that type.

Important: The Settings API is not used to create custom form fields. To create custom form fields you would need to extend the GF_Field class, part of the Field Framework.

Examples
The following example renders the field for the field type my_custom_field_type. This function creates two text box fields.:
public function plugin_settings_fields() {
return
array(
array(
'title' => 'This is the title for Section 1',
'description' => 'This is a description of the purpose of Section 1',
'fields' => array(
array(
'label' => 'My Custom Field',
'type' => 'my_custom_field_type',
'name' => 'my_custom_field'
),
)
),
);
}

public function settings_my_custom_field_type(){
?>

My custom field contains a few settings:

settings_text(
array(
'label' => 'Item 1',
'name' => 'my_custom[1]',
'default_value' => 'Item 1'
)
);
$this->settings_text(
array(
'label' => 'Item 2',
'name' => 'my_custom[2]',
'default_value' => 'Item 2'
)
);
}

The following example has a custom field type named 「text_with_checkbox」. This custom type creates a text box field and a checkbox field.
public function plugin_settings_fields() {
return
array(
array(
'title' => 'Custom Types',
'fields' => array(
array(
'type' => 'text_with_checkbox',
'name' => 'text_checkbox',
'label' => 'Text box with a checkbox',
),
),
),
)
}

public function settings_text_with_checkbox(){
?>

This is a custom field type which will create a text box and a check box

settings_text(
array(
'label' => 'Text Box With Checkbox',
'name' => 'txt_cbx[1]',
'default_value' => 'Item 1'
)
);

$this->settings_checkbox(
array(
'label' => 'Checkbox',
'choices' => array(
array(
'label' => 'Checkbox',
'name' => 'txt_cbx[2]',
),
),
)
);
}

Custom Field Merge Tags

Custom Field Merge Tags

SummaryUsageExample

Summary

Display a custom field value from the post/page the form was submitted from. These fields could be added through WordPress Custom Fields, through register_meta, or through a plugin like ACF, Pods or MetaBox.

Usage

{custom_field:[fieldname]}

Example

{custom_field:author_address} {custom_field:zipcode}