Description
This filter can be used to override the destination folder configured on the Dropbox feed.
Usage
The following would apply to all forms:
add_filter( 'gform_dropbox_folder_path', 'your_function_name', 10, 6 );
To target a specific form append the form id to the hook name. (format: gform_dropbox_folder_path_FORMID)
add_filter( 'gform_dropbox_folder_path_10', 'your_function_name', 10, 6 );
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.
-
$file_url string
The URL of the file 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.
add_filter( 'gform_dropbox_folder_path_10', 'change_path', 10, 6 );
function change_path( $folder_path, $form, $field_id, $entry, $feed, $file_url ) {
return $folder_path . '/' . rgar( $entry, '5' );
}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_dropbox_folder_path', $form['id'], $file['destination'], $form, $field_id, $entry, $feed, $file_url )
This filter is located in the following methods in class-gf-dropbox.php:
- GFDropbox::upload_file()
- GFDropbox::process_dropbox_fields()