Global Options
All main plugin options can be set via the Use-your-Drive menu page. Most settings will speak for
themselves but some others might need some additional information.
Private Folders
Private Folders allow you to link specific WordPress users to specific folders in the cloud.
There are two ways you can use this feature: Manually and Automatically. In the Manual mode, you
will link your WordPress Users to their own folder on your Google Drive by hand. In the Automatic
mode, you let the plugin automatically manage the Private Folders.
Global settings automatically linked Private Folders
warning
The following settings are
only used for all modules with
automatically linked
Private Folders
Setting |
Description |
Create Private Folders on registration |
Automatically create the Private Folders for an user after their registration on the site. |
Create all Private Folders the 1st time a module is used |
Immediately create all the Private Folders during the first rendering of a module that has the Private Folders feature enabled. |
Update Private Folders after profile update |
If needed, update the name of the Private Folder for an user after they have updated their profile. |
Delete Private Folders after deleting WP User |
Try to remove the users Private Folders after their account is deleted. |
Name Template |
Template used when a Private Folder for an user is created. This template can contain
several placeholders like %user_login% , %user_firstname% ,
%user_lastname% , %user_email% , %display_name% ,
%ID% , %user_role% , %yyyy-mm-dd% ,
%hh:mm% , %uniqueID% , %directory_separator% (/) .
Use %usermeta_{key}% to get your users custom meta value, where
{key} is the meta key to retrieve.
Use %postmeta_{key}% to get your post custom meta value, where
{key} is the meta key to retrieve.
If you want to be
able to send
notifications to the owner of this
folder the template should contain %user_email% . |
Global settings automatically linked Private Folders
Setting |
Description |
"Access Forbidden" Notice |
Message that is displayed when an user is visiting a module with the Private Folders feature set to 'Manual' mode while it doesn't have Private Folder linked to its account. |
Private Folders in WP Admin Dashboard
The Private Folders feature can also be used in the File Browsers in the WordPress Admin
Dashboard. To enable this, go to the tab called 'Private Folders' on the main plugin settings page
(Use-your-Drive -> Settings). The behavior of the File Browsers in the Admin section can be
changed via the setting "Private Folders in WP Admin Dashboard".
Advanced
API Application
Setting |
Description |
Use Custom App |
For an easy configuration you can just use the default App of the plugin itself. If you want to use your own
Google App, please read the extra instructions.
Create own App
|
Google Account Settings
Setting |
Description |
Google Workspace Domain |
If you have a Google Workspace Domain and you want to share your documents ONLY with users having an account in your Google Workspace Domain, please insert your domain. |
Manage Sharing Permission |
If you want to manage the file sharing permissions manually by yourself, disable this function. This can be useful for instance, when you are using this plugin in an intranet environment. |
Advanced
Setting |
Description |
Preferred Download Method |
Select the method that should be used to download your files. Default is to redirect the user to a temporarily url. If you want to use your server as a proxy just set it to Download via Server. In some cases the plugin can always revert to the Download via Server method. |
Load Javascripts on all pages |
By default the plugin will only load it scripts when the module is present on the page.
If you are dynamically loading content via AJAX calls and the plugin does not show up,
please enable this setting. It will force the plugin to loads its scripts on all your pages.
No worries about loading performances, as the files will automatically be cached by your
browser once loaded. |
Enable Gzip compression |
Enables gzip-compression if the visitor's browser can handle it. This will increase the
performance of the plugin if you are displaying large amounts of files and it reduces
bandwidth usage as well. It uses the PHP ob_gzhandler() callback.
info_outline
Please use this setting with caution. Always test if the plugin still works on the
Front-End!
|
Nonce Validation |
The plugin uses, among others, the WordPress Nonce system to protect you against several
types of attacks including CSRF. Disable this in case you are encountering a conflict with a
plugin that alters this system.
info_outline
Please use this setting with caution! Only disable it when really necessary.
|
Delete settings on Uninstall |
When you uninstall the plugin, what do you want to do with your settings? You can save them for next time, or wipe them back to factory settings. |
Integrations
URL Shortener
You can shorten the links created by the plugin with the the shorten APIs of Shorte.st, Rebrandly and Bit.ly
ReCaptcha V3
reCAPTCHA protects you against spam and other types of automated abuse. With this reCAPTCHA (V3)
integration module, you can block abusive downloads of your files by bots.
Video Advertisements (IMA/VAST)
The mediaplayer of the plugin supports VAST XML advertisments to offer monetization options for
your videos. You can enable advertisments for the complete site and per Media Player module.
Currently, only Linear elements using MP4 are supported.
There are quite some providers that can be used to create your Ad campaigns and to get a VAST XML
url. You could for instance use DoubleClick/Google Ad Manager. You can read more about that in the
Google Ads Help center.
Google Ads Help
Setting |
Description |
VAST XML Tag Url |
Example: https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=
|
Enable Skip Button |
Allow user to skip advertisment after after the following amount of seconds have elapsed.
|
Notifications
The plugin can send email notifications when the plugin loses its authorization to one of the
cloud accounts, and files are downloaded, uploaded or deleted. The
email settings and (HTML) content of the emails can be controlled via this settings page.
Email Sender Information
Setting |
Description |
From Name |
Enter the name you would like the notification email sent from, or use one of the
available placeholders. |
From Email |
Enter an authorized email address you would like the notification email sent from. To
avoid deliverability issues, always use your site domain in the from email. |
Notifications
The following placeholders can be used inside the template fields:
Placeholder |
Description |
%site_name% |
Site title as set on the WordPress General Settings page |
%number_of_files% |
Number of files (int) which are processed for this notification |
%user_name% |
Name of the user executing the action |
%user_email% |
Email of the user executing the action |
%user_firstname% |
First Name of the user executing the action |
%user_lastname% |
Last Name of the user executing the action |
%recipient_name% |
Name of the user receiving the email |
%recipient_email% |
Email of the user receiving the email |
%recipient_firstname% |
First Name of the user receiving the email |
%recipient_lastname% |
Last Name of the user receiving the email |
%account_email% |
Email Address that belongs to the cloud account |
%admin_email% |
Administration Email Address as set on the WordPress General Settings page |
%file_name% |
File name |
%file_size% |
File size in a readable format |
%file_icon% |
Simple mimetype file icon |
%file_relative_path% |
File path relative from the module that is being used |
%file_absolute_path% |
File path starting at the root folder of your account |
%file_cloud_download_url% |
A direct download link to the file in the cloud. User needs
to have access to the file on the Cloud |
%file_cloud_preview_url% |
A preview link to the file in the cloud. User needs to have access to the file on the
Cloud |
%file_cloud_shared_url% |
A shared link to the file in the cloud, accessible by anyone with the link |
%file_download_url% |
A direct download link to the file. The file is only accessible by users which have the
'Download Permission' for the module |
%folder_name% |
Folder name |
%folder_relative_path% |
Folder path relative from the module that is being used |
%folder_absolute_path% |
Folder path starting at the root folder of your account |
%folder_url% |
A preview link to the folder |
%ip% |
IP of the user executing the action |
%location% |
Country/Region/City of the user that executes the action. Use the http://www.geoplugin.net
API service |
The content of the notification will be added to a global email template which is stored in
/templates/notifcations/default_notification.php
.
Don't edit this file directly as it will automatically be overwritten when updating the plugin.
Instead, use the useyourdrive_notification_set_template
filter to modify the location
of the template that needs to be used.
Example
add_filter('useyourdrive_notification_set_template','change_notification_email', 10, 2);
function change_notification_email($template_location, $notification){
return WP_CONTENT_DIR .'/custom_notifications/default_notification.php';
}
Permissions
The Permissions tab controls who has access to which functionality of the plugin. You can use it
(e.g.) to prevent specific administrators to access the plugin settings or disable the Module
Builder for certain Editors.
You can set permissions for who can
- change the plugin settings;
- link users to private folders;
- see statistics and reports;
- access the main File Browser;
- add new modules;
- add direct links;
- embed documents.
Statistics
To log all events which are executed by the plugin, Enable the Log Events setting
on the Statistics tab. The logged events are accessible via the 'Use-your-Drive' ->
'Reports' menu.
Setting |
Description |
Log Events |
Allow the plugin to register all plugin events. |
- Summary Email |
Email a summary of all the events that are logged with the plugin. |
--- Interval |
Select the interval the summary needs to be send. |
--- Recipients |
Set to which email address(es) the summary should be send. |
- Use Webhook |
Send automated messages (JSON data) to another application for every event logged by the plugin. |
--- Webhook Endpoint URL |
The listener URL where the JSON data will be send to. |
--- Webhook Secret |
The events send to your endpoint will include a signature. You can use this secret to verify that the events were sent by this plugin, not by a third party. See the documentation for more information. |
Use Google Analytics tracker |
The plugin will send its events to Google Analytics if your Google tracker has been added to your site. |
Email summary
The plugin can send an overview of all the events that happend in a certain period. To enable
this, the plugin has to log events and Summary Email setting on the Statistics tab
should be enabled.
The email template is stored in /templates/notifcations/event_summary.php
.
Don't edit this file directly as it will automatically be overwritten when updating the plugin.
Instead, use the useyourdrive_events_set_summary_template
filter to modify the
location of the template that needs to be used.
Example
add_filter('useyourdrive_events_set_summary_template','change_event_summary_email', 10, 2);
function change_event_summary_email($template_location, $notification){
return WP_CONTENT_DIR .'/custom_notifications/event_summary.php';
}
Google Analytics
Is the report functionality of the plugin not sufficient for your situation? The plugin can send
all download/upload events to Google Analytics.
If you enable this feature, please make sure you already added your Google Analytics web
tracking code to your site. In most themes you will have a Custom Script box where you can
add your Google Analytics code.
All events in the plugin are registered in Google Analytics as 'Events'. So, in your Google
Analytics Dashboard you will find this under 'Behavior' -> 'Events' ->
'Overview'.
Webhooks
The built in Webhooks function is an easy way to get automated messages based on all events the plugin logs. The plugin can send a JSON object to a by you specified listener URL, containg all information regarding the event that is being logged.
You can enable the Webhook functionality via the Statistics tab under Log Events -> Webhook Endpoint URL.
Available events types:
useyourdrive_previewed_entry
,
useyourdrive_edited_entry
,
useyourdrive_downloaded_entry
,
useyourdrive_streamed_entry
,
useyourdrive_created_link_to_entry
,
useyourdrive_renamed_entry
,
useyourdrive_deleted_entry
,
useyourdrive_created_entry
,
useyourdrive_updated_metadata
,
useyourdrive_moved_entry
,
useyourdrive_uploaded_entry
,
useyourdrive_uploaded_failed
,
useyourdrive_searched
,
useyourdrive_sent_notification
,
useyourdrive_error
Example Data:
{
"total": 1,
"events": [
{
"timestamp": "2022-05-01T00:05:00+00:00",
"type": "useyourdrive_previewed_entry",
"description": "John Johnson previewed the file UK Festival Market Report.pdf",
"data": {
"entry": {
"id": "1-y9psKPDJCycz38c2sN_a3lRoO9S",
"name": "UK Festival Market Report.pdf",
"mimetype": "application/pdf",
"size": "2 MB",
"icon": "https://...",
"description": "Festival Insights and the UK Festival Awards are proud to release the UK Festival Market Report 2017.",
"thumbnail": "https://...",
"preview_url": "https://...",
"download_url": "https://...",
"is_dir": false,
"parent_id": "0By3zfuC9ZTdGZCT1pUd0E",
"parent_path": "/Path/To/Folder"
},
"account": {
"id": "1030123322434145",
"name": "Your Account name",
"email": "info@example.com",
"image": "https://..."
}
},
"user": {
"ID": "3",
"user_login": "John Johnson",
"user_nicename": "john-johnson",
"user_email": "info@example.com",
"display_name": "John Johnson"
},
"page": "https://yoursite.com/page"
},
{
"timestamp": "2022-05-01T00:05:01+00:00",
"type": "useyourdrive_deleted_entry",
...
}
]
}
Example Webhook listener (PHP):
// Optional: Prevent replay attacks by ensuring this request has been signed
// recently (+/- 5 minutes). The request timestamp is in ms!
$time_difference = abs((time() - intval($_SERVER['HTTP_X_WPCP_TIMESTAMP'])) / 1000);
if ($time_difference > 300) {
exit('Invalid request timestamp');
}
// Calculate challenge hash by concatenating the request timestamp with the
// webhook secret with a semicolon in between: "timestamp;secret".
// Hash is created with SHA256 encoded as hexdecimal lowercase string.
$secret = 'your_secret';
$challenge = hash('sha256', $req_timestamp.';'.$secret);
// Calculate request body signature using the challenge hash as secret.
// Signature is a HMAC SHA256 hash encoded as hexdecimal lowercase string.
$req_raw_body = file_get_contents('php://input');
$expected_signature = 'sha256='.hash_hmac('sha256', $req_raw_body, $challenge);
// Compare expected with received signature.
$req_signature = $_SERVER['HTTP_X_WPCP_SIGNATURE'];
if ($expected_signature !== $req_signature) {
exit('Invalid signature');
}
// Finally, parse the JSON request body and process the received events.
$data = json_decode($req_raw_body, true);
Shortcode Builder
The different plugin views: File Browsers, Galleries, Media Players, Upload Boxes are controlled
via modules. The modules
can be easily generated via the Shortcode Builder of the plugin
which you can find in the WordPress Page Editor. This Shortcode Builder has an impressive number of
options which will be explained in this section
Module
On the Module tab select which View you want to use to display your files. Each view has
different options available which will automatically become available in the Shortcode Builder.
Content
Use the Content tab to select which folder should be used a 'root' folder for this
module. On this tab you can also enable the Private Folder feature which will give users
their own folder. You can find this setting in the 'Smart Client Area' section.
Setting |
Description |
Point to specific cloud account |
Use a folder from one of the linked account. Disabling this option allows your users to navigate through the folders of all your linked cloud accounts. |
Select top folder |
Select which folder should be used as starting point. Users will not be able to navigate
outside this folder. When using automatically created Private Folders, the specific folders
will be created inside this top folder. |
info_outline
Media files will have a
code button behind the file name. Use this
button to embed this file directly with a Media Player module.
Dynamic Folders / Private Folders
Instead of using a static folder location, the module can also point to a dynamic folder location. For instance, you can use this functionality to easily and securily share documents on your cloud account with your users/clients by strictly giving users access to their own folder. This allows your clients to preview, download and manage their documents in their own private folder..
Dynamic folders are a powerfull settings for many use cases. For example:
- You want to share documents with your clients privately;
- You want your clients, users or guests upload files to their own folder;
- You want to give your customers a private folder already filled with some files directly after
they register.
help Video Instructions
Setting |
Description |
Dynamic Mode |
Do you want to link your users manually to their Private Folder or should the plugin handle this automatically for you? |
- Name Template |
Template used when a Private Folder for an user is created.
This template supports the placeholders %user_login% ,
%user_firstname% ,
%user_lastname% , %user_email% , %display_name% ,
%ID% , %user_role% ,
%usermeta_{key}% ,%post_id% ,%post_title% ,
%postmeta_{key}% ,
%yyyy-mm-dd% ,
%hh:mm% , %uniqueID% , %directory_separator% (/) . If
you want to be able to send notifications to the owner of this
folder the template should contain %user_email% . Leave empty to use the value
that is set globally.
Example: Set it to%user_login% if you
want the module to display the folder /{Start
Folder}/{%user_login%} . Each user will get their own folder named with the user
login.
|
- Template Folder |
Automatically created Private Folders can be prefilled with documents from a template
folder. The content of the template folder selected will be copied to the Private Folder
when it is initiatly created. |
- Full Access |
By default, Administrator users will have access to the complete top folder and be able to
navigate through all Private Folders. When you want other users to be able do browse outside
their own Private Folders, you can use this setting. |
Open Subfolder |
Set the subfolder name or path of the sub folder inside a Private Folder which should
be set a start folder for the module. The subfolder will be automatically created if it does
not yet exist.
This template supports the placeholders %user_login% ,
%user_firstname% ,
%user_lastname% , %user_email% , %display_name% ,
%ID% , %user_role% ,
%usermeta_{key}% ,%post_id% ,%post_title% ,
%postmeta_{key}% ,
%yyyy-mm-dd% ,
%hh:mm% , %uniqueID% , %directory_separator% (/)
Example: Set it to/Documents/%yyyy-mm-dd% if
you want the module to display the sub folder {Start
Folder}/{Name Template}/Documents/{%yyyy-mm-dd%}
> |
Actions
By default, the module will only allow users to preview, download and search files. If you want to
allow different actions as well you can control this on the Actions tab. You can set for each action which User Role or User should be able to execute that action.
The following actions are supported:
Basic Actions
- Preview
Setting |
Description |
Inline Preview |
Open preview inside a lightbox. If disabled, the preview will open in a new tab. |
--- Google popout button |
Activate the Google Pop Out button which is visible in the inline preview for a couple of file formats. |
Who can preview files? |
Select which roles or user should be able to perform this action via the module. |
- Download
Setting |
Description |
Allow ZIP Downloads |
Lets users select multiple files and folder and download them as a ZIP package. |
Who can download? |
Select which roles or user should be able to perform this action via the module. |
- Upload
Setting |
Description |
Who can upload? |
Select which roles or user should be able to perform this action via the module. |
- Search
Setting |
Description |
Full-Text search |
Search in file content, descriptions, tags and other metadata. (when files are indexed) |
Initial Search Term |
Add search terms if you want to start a search when the shortcode is rendered. Please note that this only affects the initial render. If you want to only show specific files, you can use the Filters tab. |
Files & Folder Actions
- Direct Link
Generate links to documents on your website. Only users with access to the module and its content will be able to open the link.
Setting |
Description |
Who can link to content? |
Select which roles or user should be able to perform this action via the module. |
- Share
Generate permanent shared links to your content in the Cloud.
Setting |
Description |
Who can share content? |
Select which roles or user should be able to perform this action via the module. |
- Create new documents
Create new Google Documents via this module.
Setting |
Description |
Who can create documents? |
Select which roles or user should be able to perform this action via the module. |
- Create new folders
Setting |
Description |
Who can create folders? |
Select which roles or user should be able to perform this action via the module. |
- Create shortcuts
Setting |
Description |
Who can create shortcuts for files? |
Select which roles or user should be able to perform this action via the module. |
Who can create shortcuts for folders? |
Select which roles or user should be able to perform this action via the module. |
- Add/Edit descriptions
Setting |
Description |
Who can add/edit descriptions? |
Select which roles or user should be able to perform this action via the module. |
- Edit Google Docs and Office documents
Setting |
Description |
Who can edit documents? |
Select which roles or user should be able to perform this action via the module. |
- Rename
Setting |
Description |
Who can rename files? |
Select which roles or user should be able to perform this action via the module. |
Who can rename folders? |
Select which roles or user should be able to perform this action via the module. |
- Move
Setting |
Description |
Who can move files? |
Select which roles or user should be able to perform this action via the module. |
Who can move folders? |
Select which roles or user should be able to perform this action via the module. |
- Copy
Setting |
Description |
Who can copy files? |
Select which roles or user should be able to perform this action via the module. |
Who can copy folders? |
Select which roles or user should be able to perform this action via the module. |
- Delete
Setting |
Description |
Delete to trash |
Place deleted items in trash instead of immediately deleting them permanently. |
Who can delete files? |
Select which roles or user should be able to perform this action via the module. |
Who can delete folders? |
Select which roles or user should be able to perform this action via the module. |
Layout
On the Layout tab you can select how the module should be rendered. This includes settings for the module container itself and specific customization options for every module.
- Module Container All modules
Setting |
Description |
Module width |
Set maximum width for the plugin container. You can use pixels or percentages. For instance: '360px', '480vw', '70%'. Leave empty for default value. |
Module height |
Set maximum height for the plugin container. You can use pixels or percentages. For instance: '360px', '480vh', '70%'. Leave empty for default value. |
Custom CSS Classes |
Add your own custom classes to the plugin container. Multiple classes can be added seperated by a whitespace. |
- File Browser
Setting |
Description |
File Browser view |
Grid/Thumbnail view or List view. |
- Show thumbnails on hover (List View) |
Display a thumbnail when hovering over an file in the List view.. |
Show file extension |
|
Show file size |
|
Show last modified date |
|
- Gallery
Setting |
Description |
Show file names |
Display or Hide the file names in the gallery. |
Descriptions always visible |
The description will appear on hover by default. When this setting is enabled it will always be visible. |
Image row height |
The ideal height you want your grid rows to be. The module will slightly adjusts the row height to fit the images in the masonary grid. |
Number of images lazy loaded |
Number of images to be loaded when scrolling down the page. Set to 0 to load all images at once. |
- Lightbox File Browser Gallery
Setting |
Description |
Show Thumbnails |
Show thumbnails of the files inside the Lightbox. |
Navigation |
Navigate through your documents in the inline preview. Disable when each document should be shown individually without navigation arrows. |
Enable Slideshow |
Automatically start the Slideshow mode when the lightbox is opened. |
- Delay between slides |
Delay between cycles in milliseconds. Defaults to 5000. |
- Header File Browser Gallery
Setting |
Description |
Show header |
Display a header containg the folder path as breadcrumb above the module. |
- Show refresh button |
Add a refresh button in the header so users can refresh the data in the module and pull changes. |
- Start text breadcrumb path |
Set a custom "Home" or "Start" text for the top folder in breadcrumb folder path. |
- Media Player
Setting |
Description |
Video aspect ratio |
Select the aspect ratio of your videos. The height of the video player will be set accordingly. |
Auto Play |
Start the media directly when the module is rendered. |
Mediaplayer Buttons |
Set which buttons (if supported) should be visible in the mediaplayer. |
Enable Video Advertisements |
Supports VAST XML advertisments to offer monetization options for your videos. Currently, only Linear MP4 elements are supported. |
Show Playlist |
|
- Playlist open on start |
Display the playlist directly when the module is rendered. |
- Playlist opens on top of player |
Display the playlist above the video container. |
- Display thumbnails |
Add thumbnails for the items in the playlist. |
- Show last modified date |
Display the last modified date in the playlist. |
- Link to webshop |
Display a purchase button for your media by adding an url to your webshop. |
Sort Order
Use the Sorting tab to change the sorting behavior of your documents.
Setting |
Description |
Sort field |
Select the field that should be used to sort the documents. Values: Name ,
Size , Date of creation ,Last modified date ,
Shuffle |
Sort order |
Select the sorting order of the documents: Ascending or
Descending |
Filters
Use the Filters tab when you want change the output of the module and e.g. list specific files, folders or extensions only.
Setting |
Description |
Include files |
Display your files in the module. |
Include files |
Display your folders in the module. |
Maximum number of files & folders |
Maximum number of files & folders to show in the module. Can be used for instance to only show the last 5 updated documents. Leave this field empty or set it to -1 for no limit. |
Filter by file extension
Setting |
Description |
Show the following files |
Add extensions separated with a pipe symbol: | . E.g. jpg|png|gif . |
Hide the following files |
Add extensions separated with a pipe symbol: | . E.g. jpg|png|gif . |
Filter by Name or ID
Setting |
Description |
Show the following files |
Add files or folders by Name or ID separated with a pipe symbol: | . E.g. file1.jpg|long folder
name . Wildcards like * and ? are supported. |
Hide the following files |
Add files or folders by Name or ID separated with a pipe symbol: | . E.g. file1.jpg|long folder
name . Wildcards like * and ? are supported. |
Upload Settings
Allow your visitors to upload documents to a by you selected folder. You can prefix the file name of the uploaded file and also dynamically set a folder location.
Setting |
Description |
Allow folder upload |
Adds an Add Folder button to the upload form if the browser supports it. It allows the user to upload folders keeping their folder structure intact. |
Upload immediately |
Start the upload directly once it is selected on the users device.. |
Overwrite existing files |
By default, the plugin will auto-rename new uploaded files in case of a conflict. Enable
this setting to overwrite the files instead. |
Keep last modified date |
By default, the last modified date will be changed to the date/time when the file was uploaded. If you want to keep the original date, enable this setting.. |
File Rename, prefixes & suffixes |
Add a prefix, prefixes to the name of the uploaded files and/or replace the file name itself. This can include a folder path. This field supports the placeholders
%file_name% ,
%file_extension% ,
%user_login% ,
%user_firstname% ,
%user_lastname% , %user_email% , %display_name% ,
%ID% , %user_role% ,
%usermeta_{key}% ,%post_id% ,%post_title% ,
%postmeta_{key}% ,
%yyyy-mm-dd% ,
%hh:mm% , %uniqueID% , %directory_separator% (/)
Example: Set it toDocuments/%yyyy-mm-dd%_ if
you want the module to upload the file example.jpg content to {Start
Folder}/Documents/{%yyyy-mm-dd%}_example.jpg
|
Create shared links |
Automatically create shared links for the uploaded files. |
Custom button text |
Set your own upload text on the upload button |
Upload Restrictions
Setting |
Description |
Restrict file extensions |
Add extensions separated with a pipe symbol: | . E.g. jpg|png|gif . Leave empty for no
restriction. |
Max uploads per session |
Number of maximum uploads per upload session. Leave empty for no restriction. |
Minimum file size |
Minimum file size (e.g. 1 MB ) when uploading files. Leave empty for no
restriction. |
Maximum file size |
Maximum file size (e.g. 100 MB ) when uploading files. Leave empty for no
restriction. |
Convert to Google Documents
Setting |
Description |
Convert documents |
You can convert uploaded documents to Google Documents if the file format is supported. |
Notifications
The plugin can send email notifications when files are downloaded, uploaded or deleted via the
module. The subject and (HTML) content of the emails can be controlled via this settings page.
Email notifications
Setting |
Description |
Download notification |
Send an email notification when someone downloads content via this module. |
Upload notification |
Send an email notification when someone uploads content via this module. |
Delete notification |
Send an email notification when someone deletes content via this module. |
Recipients
Setting |
Description |
Email addresses |
Add email address who should receive the notification. Add multiple address separated by a
comma , . You can also use the following placeholders:
%admin_email% => Administration email address as set on the WordPress
General Settings page;
%user_email% => Email of the user that executes the action;
%administrator% , %editor% , %subscriber% , etc...
=> All Email addresses of specific User Roles
%linked_user_email% => Email addresses of users that can access the
modified files via their Private Folders.
When using %linked_user_email% in combination with automatically linked Private
Folders, the folder names needs to contain the email address. You can achieve that by using
the %user_email% placeholder in the global Name Template setting.
|
Skip notification of the user that executes the action |
Enable if the user that performs the actions shouldn't receive the notification |
Sender information
Setting |
Description |
From Name |
Enter the name you would like the notification email sent from, or use one of the available placeholders. |
From email address |
Enter an authorized email address you would like the notification email sent from. To avoid deliverability issues, always use your site domain in the from email. |
Supported Integrations
WooCommerce Integration
Digital Downloads
Use-your-Drive integrates nicely into WooCommerce and it allows you to serve your Digital
Downloads directly from Google Drive! To add a Digital Product from your Google Drive, follow
these instructions:
- Create a new WooCommerce Product (Products -> Add New) or open an
existing one
- In the Product Data section, tick the Downloadable checkbox
- On the General tab in the same section, click on the "Choose from Google Drive" button
- In the new window that opens, click on the File that should be added to your product
- Wait till the File is added to your product
- Done!
warning
Please note that using the
'Force Download' as
File Download Method
(
WooCommerce > Settings > Products > Downloadable Products), will download the files via
your server. It is recommended to use the download method
'Redirect only' to let your
customers
download the files directly via the cloud.
In contrast with downloads stored on your server,
this setting isn't insecure for the downloads of this plugin as your customers will be
redirected to a temporarily download.
Upload integration
Use-your-Drive allows you to create products where your customers can directly attach their
Documents after purchasing. The plugin can create a Order specific folder on the linked Cloud
Account and it will add a customizable Upload Box to the order page and the Thank You page.
In order to enable the Upload Box for your products, follow these instructions
- Create a new WooCommerce Product (Products -> Add New) or open an
existing one
- In the Product Data section, tick the Uploads checkbox
- On the Upload to Cloud tab that appears, enable the "Upload to Google Drive"
checkbox
- Set in the Title Upload Box the title which should appear above the Upload Box.
- Create your own Upload Box via the Build your Upload Box button, or edit the module
manually.
- In the Upload Folder Name field, set the template which should be used for the Order
Specific Folders*.
- Save the product!
warning
* In order to use the Order Specific Folders, make sure that the Private Folder feature is
enabled in the Module. You can find this settings on the User Folders tab.
Advanced Custom Fields (ACF)
Use the Advanced Custom
Fields plugin to take full control of your WordPress edit screens &
custom field data. The ACF integration of the plugin allows you to select files and folders in the
cloud to your pages and posts! Use the get_field()
function to get access to the
metadata of the items to display this in any theme template file.
- Create a new Field Group ([Custom Fields] -> [Add New]) or open an
existing
one
- Add a new field, and select the field type [WP Cloud Plugins] -> [Google Drive
items]
- Select which data should be returned for the
get_field()
function
- Select in the Location section where the Field Group should appear
- Save the Field Group
- Done! You can now add file/folder information via the edit screens
data |
Description |
id |
The ID of the item. |
account_id |
The ID of the account the item is located. |
name |
The name of the item. |
size |
The file size of the item. |
icon_url |
An URL to a generic icon representing the file format. |
thumbnail_url |
An URL to a thumbnail of the file. If no thumbnail is available an icon will be shown.
|
direct_url |
A direct URL to the item in the cloud. Only accessible by the owners that have access to
the item in the cloud or if the item is already shared.
|
download_url |
A download URL that can be used by anyone to download the file.
|
shared_url |
A shared URL to the file is created, accessible by anyone with the link.
|
embed_url |
A shared URL for embedding the file in an iFrame. Only available for supported formats.
|
info_outline
You can select multiple items in this custom field. The
get_field()
will therefor
return an array of items.
The free GravityPDF plugin
allows you to automatically generate, email and download PDF documents with Gravity Forms.
Use-your-Drive extends this plugin and allows you to store the generated PDFs directly on your
Google Drive.
- Download and Install the GravityPDF plugin
- Head to [Forms] -> [Forms] and select the Gravity Form you want
integrated.
- From the form editor page, hover over the Form Settings menu item and select PDF from the
sub-navigation. Finally, click the Add New button to create a PDF.
- Edit the created PDF template, and go to the Advanced Tab
- Set the [GOOGLE DRIVE] Export PDF to "Yes"
- In the [GOOGLE DRIVE] Folder ID, set the ID of the folder where you want to store the
generated PDF forms. You can find this ID via the Shortcode Builder by pressing the Create
Module button.
- Press "Update PDF" to save the settings
- Done!
Uncanny Automator Integration
With Uncanny Automator, use your existing plugins, sites and apps to build powerful workflows that do everything automatically. The WP Cloud Plugins add multiple triggers which can be used in your Automate Recipies. For instance, you can fire your actions when a certain plugin event is triggered (new upload, file removal, etc). You can use it to send e.g. an email notification, a tweet, whatsapp messages or send data to other apps.
lightbulb_outline
If you are looking for specific triggers which are not you present, please let us know!
What is the API for and how can I use it?
The API is a public API that provides a standard set of tools to help developers simplify common tasks when extending the software. It's especially useful because the WP Cloud Plugins makes full use of namespaces, and working directly with our namespaced classes can be alien for developers who aren't accustom to them.
In contrast, our API is in the global scope, can be accessed through the WPCP_GDRIVE_API
class and uses static methods. You can easily call any method using WPCP_GDRIVE_API::method_name()
. This allows a lower entry barrier for developers looking to extend our software, while still allowing us to take advantage of more modern PHP techniques to streamline our development.
This section of the documentation goes into detail about the usage of each API method which can be found in the API.php file in the /wp-content/plugins/use-your-drive/includes
folder.
API – set_account_by_id()
Description
This method will set the Google account to be used for other API calls.
Parameters
$account_id | string
Return
$account | Account
- The Account object corresponding to the set Account ID.
Usage
$account = WPCP_GDRIVE_API::set_account_by_id('201096615285735764133');
// Username
$account->get_name();
// Primary emailaddress
$account->get_email();
// Profile image
$account->get_image();
// Kind of Google account
$account->get_type();
// Storage available & used.
$account->get_storage_info();
Source Code
This method is located in /includes/API.php
.
API – get_entry()
Description
This method will get the metadata for a file/folder by ID.
Parameters
$id | string
- The ID for file or folder.
Return
$node | CachedNode
- The CacheNode object for the requested file or folder.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$node = WPCP_GDRIVE_API::get_entry('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7');
$node->get_name();
Source Code
This method is located in /includes/API.php
.
API – get_folder()
Description
This method will get a specific folder on Google and the files/folders directly inside it.
Parameters
$id | string
- The ID of the folder that should be loaded.
Return
$node | CachedNode
- The CacheNode object for the requested folder.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$node = WPCP_GDRIVE_API::get_folder('1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');
$node->get_name();
foreach ($node->get_children() as $id => $entry_node) {
$entry_node->get_name();
}
Source Code
This method is located in /includes/API.php
.
API – create_entry()
Description
This method will create a new file or folder in the Cloud.
Parameters
$new_name | string
- The name of the folder to be created.
$parent_id | string
- ID of the folder where the new folder should be created.
$mimetype | string
- Mimetype of the new file. Use
'application/vnd.google-apps.folder'
for a folder.
Return
$node | CachedNode
- The CacheNode object for the new created entry.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// Create a new folder
$folder_node = WPCP_GDRIVE_API::create_entry('Documents', '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5')
// Create a new Google Spreadsheet inside the Documents folder
$sheet_node = WPCP_GDRIVE_API::create_entry('Google Sheet', $folder_node->get_id() ,'application/vnd.google-apps.spreadsheet')
Source Code
This method is located in /includes/API.php
.
API – copy()
Description
This method will copy multiple files and folders to a new location.
Parameters
$entry_ids | string[]
- ID of the entries that should be copied.
$target_id | string
- ID of the folder where the entry should be copied to.
Return
$node | CachedNode[]
- An array of Entry objects for the copied files/folders.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$entry_ids = [
'1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7',
'1w7wpGF9jo4ZDmFaXxoBRDbCnotCmypJZ'
];
$copied_nodes = WPCP_GDRIVE_API::copy($entry_ids, '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');
Source Code
This method is located in /includes/API.php
.
API – copy_folder_recursive()
Description
This method will copy the contents of an folder into another folder.
Parameters
$folder_id | string[]
- ID of the folder containing the files that should be copied.
$target_id | string
- ID of the folder where the files should be copied to.
Return
$result | bool
- The result of the copy operation.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$result = WPCP_GDRIVE_API::copy_folder_recursive('1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5', '1eedpdrZPBHpPKblQwa3khFcka1A2l0oL');
Source Code
This method is located in /includes/API.php
.
API – move()
Description
This method will move multiple files to a new location.
Parameters
$entry_ids | string[]
- ID of the entries that should be moved.
$target_id | string
- ID of the folder where the entry should be moved to.
$copy | bool
- Move or copy the entries. Default: copy = false.
Return
$node | CachedNode[]
- An array of Entry objects for the moved files/folders.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$entry_ids = [
'1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7',
'1w7wpGF9jo4ZDmFaXxoBRDbCnotCmypJZ'
];
$moved_nodes = WPCP_GDRIVE_API::move($entry_ids, '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');
Source Code
This method is located in /includes/API.php
.
API – patch()
Description
Update an file. This can be e.g. used to rename a file.
Parameters
$id | string
- ID of the entry that should be updated.
$update_request | \UYDGoogle_Service_Drive_DriveFile
- An UYDGoogle_Service_Drive_DriveFile object containing the requested patch.
Return
$node | CachedNode
- The CacheNode object for the patched file.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// Update request to rename, and add a description
$update_request = new \UYDGoogle_Service_Drive_DriveFile();
$update_request->setName('Another picture.jpg');
$update_request->setDescription('Nunc sit amet convallis ante, nec molestie leo. Duis quis egestas arcu. Sed lacinia imperdiet tellus et molestie. Nulla at ornare diam, ac pretium augue.');
// Patch the file or folder
$node = WPCP_GDRIVE_API::patch('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7', $update_request);
Source Code
This method is located in /includes/API.php
.
API – delete()
Description
This method will delete files and folders.
Parameters
$entry_ids | string[]
- Array of IDs that need to be deleted.
$trash | bool
- Trash the content or delete it permanently. Default:
$trash = true
.
Return
$node | CachedNode
- An array of Entry objects for the deleted files/folders.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$entry_ids = [
'1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7',
'1w7wpGF9jo4ZDmFaXxoBRDbCnotCmypJZ'
];
// Delete the files permanently ($trash = false)
$deleted_nodes = WPCP_GDRIVE_API::delete($entry_ids, false);
Source Code
This method is located in /includes/API.php
.
API – upload_file()
Description
Upload a file to the cloud using a simple file object.
Parameters
$file | File object
- Object containg the file details. Same as file object in
$_FILES
.
$upload_folder_id | string
$description | string
- Description for the file.
$overwrite | string
- Overwrite an existing file with the same name?
Return
$node | CachedNode
- The CacheNode object for the uploaded file.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// File location on server
$file_path = '/absolute/path/to/file/on/server.ext';
// Create File object
$file = (object) [
'tmp_path' => $file_path,
'type' => mime_content_type($file_path),
'name' => 'filename.ext',
'size' => filesize($file_path),
];
$entry = WPCP_GDRIVE_API::upload_file($file, '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5', 'A simple description', false);
Source Code
This method is located in /includes/API.php
.
API – download()
Description
Download a file.
Parameters
$id | string
- ID of the file you want to download.
$mimetype | string
- Export a file to a specified mimetype. Can be used for Google documents. Default
$mimetype = 'default';
$force_proxy | string
- Download the file via your server. If false, the plugin will redirect the user instead if possible. Default
$force_proxy = false;
Return
File Content
- This method will start a file download and exit the script.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// Download file
WPCP_GDRIVE_API::download('1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');
//Code is stopped.
Source Code
This method is located in /includes/API.php
.
API – create_preview_url()
Description
Create a preview url for a file. Only available for document formats with Google preview support.
Parameters
$id | string
- ID of the entry for which you want to create the preview download url.
Return
$url | string
- A preview url to the file
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// Create preview url
$preview_url= WPCP_GDRIVE_API::create_preview_url('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7');
Source Code
This method is located in /includes/API.php
.
API – create_shared_url()
Description
Create a shared url for a file or folder and update its sharing permissions. By default, a public shared link will be created. Google Business can request an expiring shared link or set a password.
Parameters
$id | string
- ID of the entry for which you want to create the shared url.
$params | array
- Additional params for sharing permissions. Default
$params = ['role' => 'reader']
Return
$url | string
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$params = [
'role' => 'reader'
];
// Create / Get shared links
$url = WPCP_GDRIVE_API::create_shared_url('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7', $params);
Source Code
This method is located in /includes/API.php
.
API – create_edit_url()
Description
Create an url to an editable view of the file. By default, a public shared link will be created.
Parameters
$id | string
- ID of the entry for which you want to create the shared url.
$params | array
- Additional params for sharing permissions. Default
$params = ['role' => 'writer']
Return
$url | string
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
$params = [
'role' => 'writer'
];
// Get edit url and update sharing permissions
$edit_url = WPCP_GDRIVE_API::create_edit_url('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7', $params);
Source Code
This method is located in /includes/API.php
.