• Best Drag & Drop Website Builder
  • Build Any Type of Website
  • Unlimited design flexibility
  • Drag & Drop Builder

JVM Protected Media

by Joris van Montfort

0 Ratings

Active Installations

Fewer than 10

Last Update

2 years

Quality

D

Plugin Description

Description
Protect access to all your media files and implement your own custom file access rules using a hook. Works for apache with mod rewrite or nginx with some custom configuration. No Multisite support. This plugin is more or less a development tool for defining your own custom file access rules.
For nginx you will need to modify the config file as nginx does not handle .htacess files. Add the following code:
location ~ “^/wp-content/uploads/(.*)$” {
rewrite ^/wp-content/uploads(/.*.w+)$ /index.php?jvm_protected_media_file=$1;
}
Hooks
Without a custom hook all file access will be disabled. The user will see the 404 page for all requested files. Adding a hook is needed to handle your own file access rules. A simple example that could go into your functions.php:
function my_file_access_rule($file_info) {
// Implement your own logic here
$userHasAccess = true;

if($userHasAccess) {
// Send the file output if users has access to the file
JVM_Protected_Media::send_file_output($file_info[‘path’]);
}
}

add_action( ‘jvm_protected_media_file’, ‘my_file_access_rule’);
The jvm_protected_media_file action has one parameter with the following file information:
Array
(
[id] => id_of_the_file
[url] => full/url/to/your/file
[path] => full/path/to/your/file
[is_resized_image] => bool (true if the requested file is a image thumbnail or resized version of an image)
)
Actions
Available actions:
jvm_protected_media_loaded (fires as soon as the plugin is loaded)
jvm_protected_media_file (fires when a file is requested)
Functions
To send the output of a file to you can call:
JVM_Protected_Media::send_file_output($fullPathToFile)

Similar Plugins

  • Report Bug
The content on this website originates from various sources. All rights to the original content remain with the respective author. If you believe that your copyrights have been infringed by the use of content on this website, please contact us at info@plugin-guru.com. We will remove the content in question immediately.

This is the heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Collections

Create your first Collection

To create a collection, simply click on the symbol on the desired plugin.

You can see this symbol when you move the mouse over the plugin. 

Current Level

Plugin Magican

You have reached 0 views on your collections and are currently Plugin Magican. You magically help people find the right plugins and are a great asset to the community

0 of 500 views reached