Save up to 50% off during Black Friday!

fg_entryautomation_dropbox_file_path

Description

This filter allows you to modify the path where the export file will be written to when using the Dropbox extension.

Usage

Global Usage

PHP
add_filter( 'fg_entryautomation_dropbox_file_path', 'your_function_name', 10, 4 );

Form ID specific usage

PHP
add_filter( 'fg_entryautomation_dropbox_file_path_1', 'your_function_name', 10, 4 );

Form ID and Task ID specific usage

PHP
add_filter( 'fg_entryautomation_dropbox_file_path_1_12', 'your_function_name', 10, 4 );

Parameters

  • $remote_file_path string
    Destination file path.
  • $file_name string
    Export file name.
  • $task array
    Entry Automation Task meta.
  • $form array
    The Form object.

Examples

This example shows you how to change the file path to a custom location in Dropbox. The example here grabs the existing path you’ve set in your Connection Settings tab for the task and adds a unique value from an entry.

You will need to replace ‘/Gravity Forms Add-On/’ in the snippet with the path you’ve defined in your task’s Connection Settings tab.

Note: This example will only work with an On Form Submission task.

PHP
add_filter( 'fg_entryautomation_dropbox_file_path', function( $remote_file_path, $file_name, $task, $form ) {

	if ( $task['entry_id'] ) {
		$entry = GFAPI::get_entry( $task['entry_id'] );
		$remote_file_path = str_replace( '/Gravity Forms Add-On/', '/Gravity Forms Add-On/' . rgar( $entry, 1 ) . '/', $remote_file_path );
	}

	return $remote_file_path;

}, 10, 4 );