• Resolved tlsoup

    (@tlsoup)


    I’m trying to make it so that items in my media library are protected from users not logged in. I enabled categories for media items through the Media Library Categories plug in, and assigned a few media items to that category. I set up through Content Control a restriction to make it so only logged in users can view the media with the specific category or if that category is selected. Unfortunately it isn’t working. My other restrictions are working fine, but not ones directed towards media.

    Am I missing something here, or is there a better way to do this?

    Screenshot of my Content Control settings

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Kim L

    (@kimmyx)

    Hi @tlsoup,

    For Media-related content restriction, the plugin only restricts the media on their attachment page.

    Please see: https://share.getcloudapp.com/RBuZGYj8

    However, I will raise this case with our development team so that they can take a look.

    Thank you!

    Plugin Author Daniel Iser

    (@danieliser)

    @tlsoup – We have looked to offer that a few times before, but the complexities and hackish nature of the solutions required are not ideal.

    Properly protecting the actual media files has 2 ways of being accomplished.
    1. At the server level, modifying your servers configs in a way to block access directly to the files. This has the limitation of not being able to validate against a users profile/user-role. This method is very performance based, but also hard to allow flexibility.

    2. Via PHP, replace all usage of image1.jpg with hhkalw4h5laeufojdsklah.jpg, then have a DB table that maps that hash image to a real one. Then PHP can be used to validate if the current user has permission to view that image and return a fake image if not.

    This is probably what you hoped for, BUT this makes a huge impact on your servers performance. Every protected image requires an entirely separate PHP process. This means every image will load the entirety of WordPress and all plugins, make multiple queries to the database and finally return the image.

    If you had a page with 50 images, you would be making 51 separate page load requests to your server every time that page loads. If 10 people try to load it at once, now your talking 500 requests. This very quickly overwhelms most low cost servers making it not really viable.

    Though we can implement this, we would have to recommend against most of our users enabling it without having their hosting upgraded to handle the extra loads that causes.

    We are always re-evaluating, so it could get there one day, we definitely understand the desire for such a feature.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Media Restriction not working’ is closed to new replies.