WP Cloud Plugins
PluginsPlayground ↗⏵ Open Ticket
  • Getting Started
    • System Requirements
    • Installation
    • Connect a Cloud Account
    • Add your First Module
    • How to Update?
  • Licensing
    • Activate License
    • Deactivate/Move license
    • Local/Staging sites
    • License FAQ
  • Global Options
    • Layout
    • Personal Folders
    • Review & Approve
    • Integrations
    • Notifications
    • Permissions
    • Usage Limits
    • Security
    • Advanced
    • Statistics
    • Tools
  • Modules
    • Module Manager
    • Module Configurator
      • Content
      • Accessibility
      • Dynamic Folders
      • Actions
      • Review & Approve
      • Layout
      • Sort Order
      • Filters
      • Upload Settings
      • Usage Limits
      • Notifications
    • Modules
      • Audio player
      • Button
      • Embed
      • File Browser
      • Gallery
      • List
      • Review & Approve
      • Search Box
      • Slider / Carousel
      • Upload Box
      • Video player
  • Features
    • Dynamic Folders
      • Automatic mode
      • Manual mode
    • Personal Folders
      • FAQs
    • Embed documents
    • Import to Media Library
    • Video Advertisements
    • Statistics
    • Webhooks
  • Integrations
    • Advanced Custom Fields (ACF)
    • Form Plugins
      • Contact Form 7
      • Fluent Forms
      • Formidable Forms
      • Gravity Forms
      • GravityPDF
      • NinjaForms
      • WPForms
    • Page Builders
      • Beaver Builder
      • Classic Editor
      • Divi Page Builder
      • Gutenberg
      • Elementor
    • Slack
    • Uncanny Automator
    • WooCommerce
      • Digital Downloads
      • Order Uploads
    • Easy Digital Downloads (EDD)
  • Developers
    • Actions
    • API
      • copy()
      • copy_folder_recursive()
      • create_folder()
      • create_edit_url()
      • create_preview_url()
      • create_shared_url()
      • create_temporarily_download_url()
      • delete()
      • download()
      • get_entry()
      • get_folder()
      • move()
      • patch()
      • rename()
      • set_account_by_id()
      • set_drive_by_id()
      • upload_file()
    • Filters
    • Placeholders
  • Other
    • FAQs
    • Translations
    • Vulnerabilities
    • Support
      • Scope
      • Open a Support Ticket
    • About Us
    • Changelog
Powered by GitBook
On this page
  • Slugs
  • Available filters
  • {slug}_render_formfield_data()
  • {slug}_apply_placeholders()
  • {slug}_is_entry_authorized()
  1. Developers

Filters

Our WP Cloud Plugins include a set of WordPress Filters designed to modify data before it is displayed or saved. Filters allow you to intercept and change plugin outputs or values, offering a flexible way to customize functionality. With these filters, you can adjust settings, content, or behavior in a seamless and efficient manner.

Slugs

The plugin provides several WordPress actions to hook into its functionality. These actions use a {slug} placeholder, which you should replace with the slug corresponding to your plugin variant:

  • shareonedrive for Share-One-Drive (OneDrive & SharePoint)

  • useyourdrive for Use-your-Drive (Google Drive)

  • outofthebox for Out-of-the-Box (Dropbox)

  • letsbox for Lets-Box (Box)

For example, the action {slug}_render_formfield_data(), which is applied when rendering a form submission in a form plugin entries overview, would be useyourdrive_after_module for Use-your-Drive.

All examples below use useyourdrive as slug. Make sure you update this for the plugin you are using.

Available filters

{slug}_render_formfield_data()

Fires after a module module has been rendered.

add_filter('useyourdrive_render_formfield_data', 'render_formfield_data', 10);

function render_formfield_data($data, $ashtml = true){

    // Read the array of files stored in the submission
    $uploaded_files = json_decode($data, true);
    
    // Continue if we aren't receiving any files
    if (empty($uploaded_files) || (0 === count($uploaded_files))) {
        return $data;
    }

    // Render a very basic list
    $formated_value = '';
    foreach ($uploaded_files as $file) {
        $formated_value .= basename($file['path'])." ({$file['size']})\r\n";
    }

    return $formated_value;
}

{slug}_apply_placeholders()

Replaces placeholders with values. You can add your own custom placeholders.

add_filter('useyourdrive_apply_placeholders', 'custom_placeholder', 10, 3);

function custom_placeholder($string_with_placeholders, $context = null, $extra = [])
{
    // $extra['user_data'] contains current WP_User object if available

    // Set placeholders
    $placeholders = [
        '%my_custom_placeholder%' => 'My Value',
        '%another_placeholder%' => 'Another Value',
    ];

    return strtr($string_with_placeholders, $placeholders);
}

{slug}_is_entry_authorized()

Check to see if an item has the correct permissions to be displayed in the front end.

add_filter('useyourdrive_is_entry_authorized', 'custom_placeholder', 10, 3);

function is_entry_authorized($is_authorized, $node)
{
    $entry = $node->get_entry();

    // Skip entry if its a dir or has the PHP extension
    if ($node->is_dir() || 'php' === $entry->get_extension()) {
        return false;
    }

    return $is_authorized;
}

This information is still being completed...

Previousupload_file()NextPlaceholders

Last updated 4 months ago