gform_dropbox_ssl_compatibility

gform_dropbox_ssl_compatibility

DescriptionUsageParametersPlacementSource Code

Description
The filter hook allows the SSL compatibility checks within the Dropbox add-on to be overridden. It is useful if a false negative is reported for an installed SSL certificate.
Usage
1add_filter( 'gform_dropbox_ssl_compatibility', '__return_true' );

Parameters

$ssl_support bool
If SSL is supported. If the gravityformsaddon_gravityformsdropbox_ssl option is present, returns true. Otherwise, result of checks.

Placement
This code should be placed in the functions.php file of your active theme, or ideally, in its own plugin.
Source Code
This filter is located in dropbox.php.

gform_dropbox_should_upload_file

gform_dropbox_should_upload_file

DescriptionUsageParametersExamples1. Log the paramsPlacementSinceSource Code

Description

The gform_dropbox_should_upload_file filter can be used to determine if a file for a fileupload or dropbox type field is uploaded to Dropbox.

Usage

The following would apply to all forms:

add_filter( 'gform_dropbox_should_upload_file', 'your_function_name', 10, 7 );

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

add_filter( 'gform_dropbox_should_upload_file_2', 'your_function_name', 10, 7 );

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

add_filter( 'gform_dropbox_should_upload_file_2_3', 'your_function_name', 10, 7 );

Parameters

$should_upload_file booleanIndicates if the file should be uploaded to Dropbox.$url stringThe URL of the file from the entry.$existing false|arrayFalse or an array of files previously uploaded to Dropbox for the current field and entry.$field Field ObjectThe current fileupload or dropbox field object$form Form ObjectThe form containing the current field.$entry Entry ObjectThe entry currently being processed.$feed Feed ObjectThe feed currently being processed.

Examples

1. Log the params

This is a basic usage example showing how you can log the parameters available to this filter.

add_filter( 'gform_dropbox_should_upload_file', 'log_gform_dropbox_should_upload_file', 10, 7 );
add_filter( 'gform_dropbox_should_upload_file_18', 'log_gform_dropbox_should_upload_file', 10, 7 );
add_filter( 'gform_dropbox_should_upload_file_18_6', 'log_gform_dropbox_should_upload_file', 10, 7 );
function log_gform_dropbox_should_upload_file( $should_upload_file, $url, $existing, $field, $form, $entry, $feed ) {
gf_dropbox()->log_debug( current_filter() . ': ' . print_r( func_get_args(), true ) );

return $should_upload_file;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom functions plugin, or your custom add-on.

Since

This filter was added in version 3.0.1.

Source Code

public function should_upload_file( $url, $existing, $field, $form, $entry, $feed ) {
if ( ! empty( $existing ) ) {
$should_upload_file = ! in_array( $url, $existing );
} else {
// The preview link type uses www.dropbox.com.
$should_upload_file = $field instanceof GF_Field_Dropbox && $field->get_link_type( $form ) === 'preview' || stripos( $url, 'www.dropbox.com' ) === false;
}

$filter_args = array( 'gform_dropbox_should_upload_file', $form['id'], $field->id );

if ( function_exists( 'gf_has_filters' ) && gf_has_filters( $filter_args ) ) {
$this->log_debug( __METHOD__ . '(): Executing functions hooked to gform_dropbox_should_upload_file.' );
}

/**
* Provides a way to prevent the uploading of a file to Dropbox.
*
* @since 3.1
*
* @param bool $should_upload_file Indicates if the file should be uploaded to Dropbox.
* @param string $url The URL of the file from the entry.
* @param false|array $existing False or an array of files previously uploaded to Dropbox for the current field and entry.
* @param GF_Field $field The current fileupload or dropbox field object.
* @param array $form The current form object.
* @param array $entry The current entry object.
* @param array $feed The current feed object.
*/
return (bool) gf_apply_filters( $filter_args, $should_upload_file, $url, $existing, $field, $form, $entry, $feed );
}

This filter is located in GFDropbox::should_upload_file() in class-gf-dropbox.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_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_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_dropbox_link_type

gform_dropbox_link_type

DescriptionUsageParametersExamplePlacementSource Code

Description
This filter can be used to change the type of link returned by Dropbox.
Usage
The following would apply to all forms:
add_filter( 'gform_dropbox_link_type', 'your_function_name', 10, 3 );

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

To target a specific field append both the form id and the field id to the hook name. (format: gform_dropbox_link_type_FORMID_FIELDID)
add_filter( 'gform_dropbox_link_type_10_3', 'your_function_name', 10, 3 );

Parameters

$linkType string
The Dropbox link type. Possible values: preview (a preview link to the document for sharing) or direct (an expiring link to download the contents of the file). Default: preview.

$form Form Object
The form currently being processed.

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

Example
This example shows how to change the link type for a specific form.
add_filter( 'gform_dropbox_store_local_version_10', 'change_link_type', 10, 3 );
function change_link_type( $linkType, $form, $field_id ) {

return 'direct';
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_dropbox_link_type', array( $form['id'], $this->id ), 'preview', $form, $this->id )

This filter is located in GF_Field_Dropbox::get_form_inline_script_on_page_render() in class-gf-field-dropbox.php.

gform_dropbox_folder_path

gform_dropbox_folder_path

DescriptionUsageParametersExamples1. Use an entry value in the destination pathPlacementSource Code

Description
This filter can be used to override the destination folder configured on the Dropbox feed.
Usage
The following would apply to all forms:
1add_filter( 'gform_dropbox_folder_path', 'your_function_name', 10, 5 );
To target a specific form append the form id to the hook name. (format: gform_dropbox_folder_path_FORMID)
1add_filter( 'gform_dropbox_folder_path_10', 'your_function_name', 10, 5 );
Parameters

$folder_path string
The folder in the Dropbox account where the files will be stored, e.g. /local.wordpress.dev.

$form Form Object
The form currently being processed.

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

$entry Entry Object
The entry currently being processed.

$feed Feed Object
The feed currently being processed.

Examples
1. Use an entry value in the destination path
This example shows how you can use a field value from the Entry Object when modifying the path.
12345add_filter( 'gform_dropbox_folder_path_10', 'change_path', 10, 5 );function change_path( $folder_path, $form, $field_id, $entry, $feed ) {     return $folder_path . '/' . rgar( $entry, '5' );}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1gf_apply_filters( 'gform_dropbox_folder_path', $form['id'], $file['destination'], $form, $field_id, $entry, $feed )
This filter is located in the following methods in class-gf-dropbox.php:

GFDropbox::upload_file()
GFDropbox::process_dropbox_fields()

gform_dropbox_file_name

gform_dropbox_file_name

DescriptionUsageParametersExamples1. Use an entry value in the filename.PlacementSource Code

Description
This filter can be used to override the filename before the file is uploaded to Dropbox.
Usage
The following would apply to all forms:
add_filter( 'gform_dropbox_file_name', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_dropbox_file_name_FORMID)
add_filter( 'gform_dropbox_file_name_10', 'your_function_name', 10, 5 );

Parameters

$file_name string
The filename, including extension, e.g. screenshot.png.

$form Form Object
The form currently being processed.

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

$entry Entry Object
The entry currently being processed.

$feed Feed Object
The feed currently being processed.

Examples
1. Use an entry value in the filename.
This example shows how you can use a value from the Entry Object when modifying the filename.
add_filter( 'gform_dropbox_file_name_10', 'change_name', 10, 5 );
function change_name( $file_name, $form, $field_id, $entry, $feed ) {

return rgar( $entry, 'id' ) . '-' . $file_name;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_dropbox_file_name', $form['id'], $file['name'], $form, $field_id, $entry, $feed )

This filter is located in the following methods in class-gf-dropbox.php:

GFDropbox::upload_file()
GFDropbox::process_dropbox_fields()

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_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.