gform_dropbox_post_upload

gform_dropbox_post_upload

DescriptionUsageParametersExamplesExample 1PlacementSource CodeSince

Description
This hook is fired after a Dropbox feed has been processed and files have been uploaded.
Usage
The following would apply to all forms.
add_action( 'gform_dropbox_post_upload', 'your_function_name', 10, 3 );

To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_dropbox_post_upload_FORMID)
add_action( 'gform_dropbox_post_upload_6', 'your_function_name', 10, 3 );

Parameters

$feed Feed Object
The current feed being processed.

$entry Entry Object
The entry that was submitted.

$form Form Object
The current form to be filtered.

Examples
Example 1
// NOTE: Update the '221' to the ID of your form.
add_action( 'gform_dropbox_post_upload_221', 'get_dropbox_urls', 10, 3 );
function get_dropbox_urls( $feed, $entry, $form ) {

foreach( $form['fields'] as &$field ) {

// NOTE: Replace 3 with your Dropbox field id.
$field_id = 3;
if ( $field->id != $field_id ) {
continue;
}

// Get the field value.
$field_value = $entry[ $field->id ];

// Exit if field value is empty.
if ( rgblank( $field_value ) ) {
return;
}

// Decode JSON string.
$files = json_decode( stripslashes_deep( $field_value ), true );

// Insert additional functionality here.

}

}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_do_action( array( 'gform_dropbox_post_upload', $form['id'] ), $feed, $entry, $form );

This filter is located in GFDropbox::maybe_process_feed_on_post_request() in class-gf-dropbox.
Since
This filter was added in Gravity Forms Dropbox Add-On 1.1.4.

gform_display_add_form_button

gform_display_add_form_button

DescriptionUsageParametersExamplesPlacementSource Code

Description
By default, the 「Add Form」 button will only be displayed on the Post or Page edit screens. Use this filter to allow the 「Add Form」 button to be displayed on other pages.
Note: The 「Add Form」 button requires a TinyMCE input, so in order to display it, you must first include a TinyMCE input to your page.
Usage
add_filter( 'gform_display_add_form_button', 'display_form_button_on_custom_page' );

Parameters

$is_post_edit_page bool
True if the current page is a Post or Page edit page. False otherwise.
$is_post_edit_page = in_array( RG_CURRENT_PAGE, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php', 'customize.php' ) );

Examples
This example enables the 「Add Form」 button on a custom page whose URL contains the following query string: 「page=my_page」.
add_filter( 'gform_display_add_form_button', 'display_form_button_on_custom_page' );
function display_form_button_on_custom_page( $is_post_edit_page ) {
if ( isset( $_GET['page'] ) && $_GET['page'] == 'my_page' ) {
return true;
}

return $is_post_edit_page;
}

Simple example to disable button.
add_filter( 'gform_display_add_form_button', '__return_false' );

This example enables the 「Add Form」 button if the page is not a post page.
add_filter( 'gform_display_add_form_button', function ( $is_post_edit_page ) {
global $current_screen;

return $current_screen instanceof WP_Screen && $current_screen->base != 'post' ? true : $is_post_edit_page;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFForms::page_supports_add_form_button() in gravityforms.php.

gform_disable_installation_status

gform_disable_installation_status

DescriptionUsageParametersPlacementSource CodeSince

Description
This filter is used to disable the display of the Installation Status section on the Forms > Settings page.
Usage
1add_filter( 'gform_disable_installation_status', '__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 GFSettings::gravityforms_settings_page() in settings.php
Since
This filter was added in Gravity Forms 1.9.11.1

gform_dropbox_request_timeout

gform_dropbox_request_timeout

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description

The 「gform_dropbox_request_timeout」 filter in the Gravity Forms Dropbox Add-On allows the request timeout length for the feed processing request to be modified.

Usage

add_filter( 'gform_dropbox_request_timeout', 'your_function_name', 10, 1 );

Parameters

$timeout int
The time in seconds before the connection is dropped and an error returned.

Examples

add_filter( 'gform_dropbox_request_timeout', 'gf_change_timeout' );
function gf_change_timeout( $timeout ){
return 90; // Change 90 to a higher value if needed.
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in version 2.0.

Source Code

This filter is located in GF_Dropbox::maybe_process_feed_on_shutdown() in gravityformsdropbox/class-gf-dropbox.php.

gform_display_field_select_columns_entry_list

gform_display_field_select_columns_entry_list

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows fields to be added or removed from the select columns UI on the entry list.
Usage
The following would apply to all forms:
add_filter( 'gform_display_field_select_columns_entry_list', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_display_field_select_columns_entry_list_FORMID)
add_filter( 'gform_display_field_select_columns_entry_list_1', 'your_function_name', 10, 3 );

To target a specific form』s field, append the form id and field id to the hook name. (format: gform_display_field_select_columns_entry_list_FORMID_FIELDID)
add_filter( 'gform_display_field_select_columns_entry_list_1_1', 'your_function_name', 10, 3 );

Parameters

$display bool
Indicates whether the field will be available for selection.

$field Field Object
The current field.

$form Form Object
The current form.

Examples
add_filter( 'gform_display_field_select_columns_entry_list', 'show_hide_fields', 10, 3 );
function show_hide_fields( $display, $field, $form ){
if ( $field['id'] == 4 ){
return true;
}
return false;

}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.4.
Source Code
This filter is located in GFSelectColumns::select_columns_page() in gravityforms/select_columns.php.

gform_disable_notification

gform_disable_notification

DescriptionUsageParametersExamples1. Disable ALL Notifications2. Disable a notification based on a field3. Update from gform_disable_user_notification4. Update from gform_disable_admin_notification5. Disable based on payment/subscription eventPlacementSource Code

Description

Use this filter to disable admin and user notification emails.

Usage

add_filter( 'gform_disable_notification', 'your_function_name', 10, 4 );

You can also specify this per form by adding the form id after the hook name.

add_filter( 'gform_disable_notification_6', 'your_function_name', 10, 4 );

Parameters

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

$notification array
Current Notification array

$form Form Object
Current form.

$entry Entry Object
Current Entry array

$data array
Array of data which can be used in the notifications via the generic {object:property} merge tag. Defaults to empty array. Since: 2.3.6.6.

Examples

1. Disable ALL Notifications

This example disables admin and user notifications for all forms

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {
return true;
}

2. Disable a notification based on a field

This example shows you how to disable a notification conditionally based on a field of the entry. This can help you in situations where conditional logic can』t be used (e.g. To send a notification only if an upload field was not used).

add_filter( 'gform_disable_notification', 'disable_notification_by_field', 10, 4 );
function disable_notification_by_field( $is_disabled, $notification, $form, $entry ) {

$field_to_check = rgar( $entry, '1' ); // Replace 1 by your field id number

// Replace User Notification by your notification name.
if ( $notification['name'] == 'User Notification' && ! empty( $field_to_check ) ) { // Disable notification only if $filed_to_check is not empty.
return true;
}

return $is_disabled;
}

3. Update from gform_disable_user_notification

This example shows you how to update your code from the deprecated gform_disable_user_notification hook

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {

//There is no concept of user notifications anymore, so we will need to disable notifications based on other criteria such as name
if ( $notification['name'] == 'User Notification' ) {
return true;
}

return $is_disabled;
}

4. Update from gform_disable_admin_notification

This example shows you how to update your code from the deprecated gform_disable_admin_notification hook

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {

//There is no concept of admin notifications anymore, so we will need to disable notifications based on other criteria such as name
if ( $notification['name'] == 'Admin Notification' ) {
return true;
}

return $is_disabled;
}

5. Disable based on payment/subscription event

This example shows how a notification assigned to a payment or subscription event could be disabled based on the event properties.

add_filter( 'gform_disable_notification', function( $is_disabled, $notification, $form, $entry, $data ) {
if ( isset( $data['payment_action'] ) && empty( $data['payment_action']['amount'] ) ) {
$is_disabled = true;
}

return $is_disabled;
}, 10, 5 );

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in GFAPI::send_notifications() in includes/api.php

gform_dropbox_shareable_link_settings

gform_dropbox_shareable_link_settings

DescriptionUsageParametersExamples1. Team Only2. Password Protected3. Expiration DatePlacementSource Code

Description

This filter can be used to modify the settings before a Dropbox shareable link is generated, allowing for the link to expire after a certain time or change who is allowed to access it.

Dropbox.com requires an account with a Professional or Business plan to control the share link settings.

Usage

The following would apply to all forms:

add_filter( 'gform_dropbox_shareable_link_settings', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_dropbox_shareable_link_settings_FORMID)

add_filter( 'gform_dropbox_shareable_link_settings_10', 'your_function_name', 10, 5 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_dropbox_shareable_link_settings_FORMID_FIELDID)

add_filter( 'gform_dropbox_shareable_link_settings_10_3', 'your_function_name', 10, 5 );

Parameters

$shareable_link_settings array
The shareable links settings. Possible values are public, team_only or password. More details can be found in Dropbox API docs.
array(
'requested_visibility' => 'public',
);

$field_id string
The ID of the field currently being processed.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$feed Feed Object
The feed currently being processed.

Examples

1. Team Only

This example allows the shareable link to only be accessible to members of the same Dropbox Business Plan team.

add_filter( 'gform_dropbox_shareable_link_settings', 'shareable_link_team_only', 10, 5 );
function shareable_link_team_only( $shareable_link_settings, $field_id, $form, $entry, $feed ) {
$shareable_link_settings['requested_visibility'] = 'team_only';

return $shareable_link_settings;
}

2. Password Protected

This example allows the shareable link to only be accessible with a specific password.

add_filter( 'gform_dropbox_shareable_link_settings', 'shareable_link_with_password', 10, 5 );
function shareable_link_with_password( $shareable_link_settings, $field_id, $form, $entry, $feed ) {
$shareable_link_settings['requested_visibility'] = 'password';
$shareable_link_settings['link_password'] = 'Sup3rS3cr3tP@ssw0rd';

return $shareable_link_settings;
}

3. Expiration Date

This example allows the shareable link to only be accessible for one week after creation.

add_filter( 'gform_dropbox_shareable_link_settings', 'shareable_link_one_week', 10, 5 );
function shareable_link_team_only( $shareable_link_settings, $field_id, $form, $entry, $feed ) {
$shareable_link_one_week['expires'] = date( 'Y-m-dTH:i:sZ', strtotime( '+1 week' ) );

return $shareable_link_settings;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

gf_apply_filters( array( 'gform_dropbox_shareable_link_settings', $form['id'], $field_id ), array( 'requested_visibility' => 'public' ), $field_id, $form, $entry, $feed )

This filter is located in GFDropbox::upload_file() in class-gf-dropbox.php.

gform_display_product_summary

gform_display_product_summary

DescriptionUsageParametersExamples1. Disable for all forms2. Disable for a specific formPlacementSource CodeSince

Description
This filter can be used to prevent the pricing summary being included in the output generated when using the {all_fields} merge tag. The pricing fields will be output just like the other form fields instead.
Usage
The following would apply to all forms:
1add_filter( 'gform_display_product_summary', 'your_function_name', 10, 4 );
Parameters

$display_product_summary boolean
Is the pricing summary table to be included in the {all_fields} output? Default is true.

$field Field Object
The field currently being processed.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

Examples
1. Disable for all forms
This example shows how you can disable the pricing summary table for all forms.
1add_filter( 'gform_display_product_summary', '__return_false' );
2. Disable for a specific form
1234add_filter( 'gform_display_product_summary', function( $display_product_summary, $field, $form, $entry ) {     return $form['id'] == 10 ? false : $display_product_summary;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1apply_filters( 'gform_display_product_summary', true, $field, $form, $entry )
This filter is located in GFCommon::get_submitted_fields() and GFCommon::is_section_empty() in common.php
Since
This filter was added in Gravity Forms 1.8.8.

gform_disable_post_creation

gform_disable_post_creation

DescriptionUsageParametersExamples1. Disable for all forms2. Disable based on a field valuePlacementSource Code

Description
Use this filter to disable post creation when submitting a Gravity Form.

Note: This filter is intended for use with Gravity Forms built-in Post creation feature, it doesn』t support the Advanced Post Creation add-on.

Usage
1add_filter( 'gform_disable_post_creation', 'disable_post_creation', 10, 3 );
You can also specify this per form by adding the form id after the hook name.
1add_filter( 'gform_disable_post_creation_6', 'disable_post_creation', 10, 3 );
Parameters

$is_disabled bool
Variable to be filtered. Set it to true to prevent posts from being created.

$form Form Object
Current form.

$entry Entry Object
Current Entry array.

Examples
1. Disable for all forms
This example disables the post creation process for all forms:
1234add_filter( 'gform_disable_post_creation', 'disable_post_creation', 10, 3 );function disable_post_creation( $is_disabled, $form, $entry ) {    return true;}
2. Disable based on a field value
12345add_filter( 'gform_disable_post_creation_6', 'disable_post_creation', 10, 3 );function disable_post_creation( $is_disabled, $form, $entry ) {    $is_disabled = rgar( $entry, '2' ) != 'something' ? true : $is_disabled;    return $is_disabled;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFCommon::create_post() in common.php.

gform_date_max_year

gform_date_max_year

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to specify the maximum year displayed in the date field』s year drop down and the HTML5 max attribute for the date field』s year input.
Usage
add_filter( 'gform_date_max_year' , 'set_max_year' );

Parameters

$max_date string
The maximum date to be filtered. Defaults to the current year plus one.

$form Form Object
Current form object.

$field Field Object
Current field object.

Examples
This example changes the max date to 2022.
add_filter( 'gform_date_max_year', 'set_max_year' );
function set_max_year( $max_year ) {
return 2022;
}

This example changes the max date for a specific field on a specific form.
add_filter( 'gform_date_max_year', function ( $max_year, $form, $field ) {

return $form['id'] == 7 && $field->id == 5 ? 2022 : $max_year;
}, 10, 3 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods in includes/fields/class-gf-field-date.php:

GF_Field_Date::get_field_input()
GF_Field_Date::get_year_dropdown()