gform_disable_auto_update

gform_disable_auto_update

DescriptionUsageParametersExampleSource Code

Description
The 「gform_disable_auto_update」 filter allows automatic updates to be turned off in Gravity Forms.
Usage
1add_filter( 'gform_disable_auto_update', __return_true );

Parameters

$disabled bool
Set to 『true』 to disable automatic updates. False to enable them. Defaults to the inverse of the gform_enable_background_updates option.

Example
1add_filter( 'gform_disable_auto_update', __return_true );
Source Code
This action hook is located in gravityforms.php

GFORM_DISABLE_AUTO_UPDATE

GFORM_DISABLE_AUTO_UPDATE

DescriptionUsageParametersExamplePlacementSource Code

Description
Allows the overriding of automatic updates.
Usage
1define( 'GFORM_DISABLE_AUTO_UPDATE', true );

Parameters

$disabled bool
Set to 『true』 to disable automatic updates. False to use defaults. Defaults to undefined.

Example
1define( 'GFORM_DISABLE_AUTO_UPDATE', true );
Placement
This constant should be set in your wp-config.php. See the article Wp Config Options for more details.
Source Code
This constant is accessed in gravityforms.php

gform_disable_admin_notification

gform_disable_admin_notification

DescriptionUsageParametersExampleSource Code

Description
Use this filter to disable admin notification emails.

This hook has been deprecated. Please use gform_disable_notification instead.

Usage
1add_filter( 'gform_disable_admin_notification', 'disable_notification', 10, 3 );
You can also specify this per form by adding the form id after the hook name.
1add_filter( 'gform_disable_admin_notification_6', 'disable_notification', 10, 3 );

Parameters

$is_disabled bool
Variable to be filtered. Set it to true to disable admin notifications

$form Form Object
Current form.

$entry Entry Object
Current Entry array

Example
This example disables admin notification for all forms.
1234add_filter( 'gform_disable_admin_notification', 'disable_notification', 10, 3 );function disable_notification( $is_disabled, $form, $entry ) {    return true;}
Source Code
This filter is located in GFAPI::send_notifications() in includes/api.php

gform_disable_address_map_link

gform_disable_address_map_link

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to disable the inclusion of the Map It link when displaying the Address field value.
Usage
1add_filter( 'gform_disable_address_map_link', '__return_true' );
Parameters
This hook has no parameters.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_Address::get_value_entry_detail() in includes/fields/class-gf-field-address.php.

gform_delete_meta()

gform_delete_meta()

DescriptionUsageParametersExamplesSource Code

Description
Deletes the meta key from the Entry Meta table.
Usage
gform_delete_meta( $entry_id, $meta_key );

Parameters

$entry_id integer
The ID of the entry.

$meta_key string
The meta key of the meta value you wish to delete.

Examples
This example simply deletes a stored entry meta value.
// deletes the meta value of the "temporary_value" entry meta key for entry ID 13
gform_delete_meta( 13, 'temporary_value' );

Source Code
This function is located in forms_model.php

gform_delete_lead

gform_delete_lead

DescriptionUsageParametersExamplesSource Code

Description
Note: This hook has been deprecated and gform_delete_entry should be used instead.
Fires right before an entry is deleted. Use this hook to perform actions when an entry is deleted.
Usage
add_action( 'gform_delete_lead', 'delete_entry_post' );

Parameters

$entry_id integer
The ID of the entry that is about to be deleted.

Examples
This example deletes the post associated with the deleted entry.
add_action( 'gform_delete_lead', 'delete_entry_post' );
function delete_entry_post( $entry_id ) {

//getting entry object
$entry = GFAPI::get_entry( $entry_id );

//if entry is associated with a post, delete it
if ( isset( $entry['post_id'] ) ) {
wp_delete_post( $entry['post_id'] );
}
}

Source Code
This filter is located in GFFormsModel::delete_lead() in forms_model.php.

gform_delete_entry

gform_delete_entry

DescriptionUsageParametersExamplesDelete PostDelete user signupDelete userSource Code

Description
The 「gform_delete_entry」 action fires right before an entry is deleted and is used to perform actions when an entry is deleted.
Note: This filter replaces the 「gform_delete_lead」 hook.
Usage
add_action( 'gform_delete_entry', 'your_function_name', 10, 1 );

Parameters

$entry_id integer
The ID of the entry that is about to be deleted.

Examples
Delete Post
This example deletes the post associated with the deleted entry.
add_action( 'gform_delete_entry', 'delete_entry_post' );
function delete_entry_post( $entry_id ) {
GFCommon::log_debug( __METHOD__ . '(): running.' );
// Getting entry object.
$entry = GFAPI::get_entry( $entry_id );
// If entry is associated with a post, delete it.
if ( isset( $entry['post_id'] ) ) {
GFCommon::log_debug( __METHOD__ . '(): Deleting post ID ' . $entry['post_id'] );
wp_delete_post( $entry['post_id'] );
}
}

Delete user signup
The following example shows how the record assiocated with an entry can be deleted from the WordPress signups table when the entry is deleted.
add_action( 'gform_delete_entry', function ( $entry_id ) {
if ( ! function_exists( 'gf_user_registration' ) ) {
return;
}

require_once( gf_user_registration()->get_base_path() . '/includes/signups.php' );
GFUserSignups::prep_signups_functionality();
$activation_key = GFUserSignups::get_lead_activation_key( $entry_id );
if ( $activation_key ) {
GFUserSignups::delete_signup( $activation_key );
}
} );

Delete user
The following example shows how the user can be deleted when the entry is deleted.
add_action( 'gform_delete_entry', function ( $entry_id ) {
if ( ! function_exists( 'gf_user_registration' ) ) {
return;
}

$user_id = gf_user_registration()->get_user_by_entry_id( $entry_id, true );
wp_delete_user( $user_id );
} );

Source Code
This filter is located in GFFormsModel::delete_entry() in forms_model.php.

gform_delete_entries

gform_delete_entries

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_delete_entries」 action is triggered when entries are deleted in Gravity Forms, allowing further actions to be performed.
Usage
1add_action( 'gform_delete_entries', 'my_function', 10, 2 );

Parameters

$form_id
The ID of the form that an entry is being deleted from.

$status
The status of the deleted entry.

Examples
1234function my_function($form_id, $status) {    echo 'Entry with status' . $status . 'is being deleted from form ' . $form_id;}add_action( 'gform_delete_entries', 'my_function', 10, 2 );
Source Code
This action hook is located in forms_model.php.

gform_default_notification

gform_default_notification

DescriptionUsageParametersExamples

Description
Use this filter to disable the default admin notification automatically generated for new forms.
Usage
1add_filter( 'gform_default_notification', '__return_false' );
Parameters

$is_enabled bool
Passes true, return false to disable.

Examples
Here is the simplest way to use this hook:
Source Code
This filter is located in GFFormDetail::save_form_info() in form_detail.php

gform_default_address_type

gform_default_address_type

DescriptionUsageParametersExamplesAustraliaPlacementSinceSource Code

Description
The gform_default_address_type filter can be used to override the default address type for new fields. It can be used together with the gform_address_types filter to add support for new country specific address types.
Usage
The base filter which would run for all forms would be used like so:
1add_filter( 'gform_default_address_type', 'your_function_name', 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_default_address_type_FORMID)
1add_filter( 'gform_default_address_type_5', 'your_function_name', 10, 2 );

Parameters

$default_address_type string
The default address type, international.

$form_id integer
The current form ID

Examples
Australia
This example shows how the default address type can be set to Australia. The Australian address type would need to have been added by the gform_address_types filter.
123add_filter( 'gform_default_address_type', function ( $default_address_type, $form_id ) {    return 'australia';}, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.0.3.2.
Source Code
This filter is located in GF_Field_Address::get_default_address_type() in includes/fields/class-gf-field-address.php.