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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注