Lock down media files
-
Hi,
I’ve got a “closed” site set up in a Multisite install, where users have to be at least Subscribers in order to see content. What I’ve found is that any content posted into the Media Library is available if they have the URL — so, for instance, https://example.com/locked-site/files/secret-document.pdf can be downloaded by someone that’s not signed in. I’d like to prevent this.
I’d like to be able to write a filter, something along the lines of:
add_filter( '???', 'lock_media' ); function lock_media( $media ) { if( ! current_user_can( 'read' ) ) { wp_die( 'Nice try!' ); } return $media; }
Is there a way to filter the content returned by the functions that handle handing files to the user? I took a look in wp-includes/ms-files.php and didn’t see any action or filter hooks, but maybe I’m just missing it.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Lock down media files’ is closed to new replies.