Using Gravity Forms ‘gform_dropbox_shareable_link_settings’ PHP filter

The gform_dropbox_shareable_link_settings filter allows you to modify the settings before a Dropbox shareable link is generated. You can use it to set an expiration date for the link, limit the access to certain people, or require a password.

Usage

add_filter('gform_dropbox_shareable_link_settings', 'your_function_name', 10, 5);

Parameters

  • $shareable_link_settings (array) – The shareable links settings, such as ‘public’, ‘team_only’, or ‘password’. More details can be found in the Dropbox API docs.
  • $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.

More information

See Gravity Forms Docs: gform_dropbox_shareable_link_settings

Examples

Team Only

This example makes the shareable link accessible only 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;
}

Password Protected

This example makes the shareable link accessible only 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;
}

Expiration Date

This example makes the shareable link accessible only for one week after creation.

add_filter('gform_dropbox_shareable_link_settings', 'shareable_link_one_week', 10, 5);
function shareable_link_one_week($shareable_link_settings, $field_id, $form, $entry, $feed) {
    $shareable_link_settings['expires'] = date('Y-m-d\TH:i:s\Z', strtotime('+1 week'));
    return $shareable_link_settings;
}

This code should be placed in the functions.php file of your active theme.