gform_dropbox_post_upload

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

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 = rgar( $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.

	}

}

Trigger Zapier Feed Processing

This example would trigger processing of Zapier feeds for the current entry of form ID 2 after the files have been uploaded to Dropbox.

add_action( 'gform_dropbox_post_upload_2', function ( $feed, $entry, $form ) {
	if ( function_exists( 'gf_zapier' ) ) {
		gf_zapier()->maybe_process_feed( $entry, $form );
		gf_feed_processor()->save()->dispatch();
	}
}, 10, 3 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

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.