Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Restrict Downloads
- This topic has 2 replies, 2 voices, and was last updated 7 years, 4 months ago by feeco.
05/11/2015 at 15:06 #1796feecoParticipant
Hi I have the pro version and am trying to restrict downloads per role. However it is not working properly. If I type in the url of the download no matter what role I am in it will download the file.
I have tried applying the role when I edit a file in the media library but it will not save the role – it just empties that box after I click save. I’ve also tried using the download monitor plugin, and have applied the role that can access the file. However i am still able to download the file no matter what role I am in.
I need the user to be logged in and in a specific role to be able to download a pdf. Can you please help me? Thank you!08/11/2015 at 02:44 #1800VladimirKeymaster
Thank you. I confirm the bug with roles saving at ‘view restriction’ meta box for attachments. I fixed it in development version.
But this restriction just exclude the attachment post from listing by WordPress when attachment listing required directly. It does not protect file from download by typing its direct URL in the browser. It does not exclude this attachment from the posts or pages to which this attachment was included.
As a temporal workaround you may use URE shortcode:
and show file URL or download link for the allowed role only.
It still will not prevent any visitor who knows direct URL from download this file, but download URL at the content will be available for the authorised users only.
In general you need a routine which should not show a direct URL to the file, but use the some kind of a download link, which will lead to the script where download will be started after checking user permissions only.
It’s possible that I will include such feature to the User Role Editor with time. Something like ‘digital file protection’ add-on.
Btw, may be some plugin from this list may help you to restrict access to the downloadable file using roles:
http://www.wpstuffs.com/plugins-to-manage-digital-downloads/09/11/2015 at 14:44 #1801feecoParticipant
Ok, thank you for this update. I think this would be a great add-on for your plugin as I thought it already did this. In the mean time I will look at the list you provided. Thank you.
- You must be logged in to reply to this topic.