I've got User Role Editor plugin installed and i want to add a capability for download files.

I've got some downloads in a custom post type called 'products'. I want only people who are logged in to be able to download or view these files. If a user isn't logged in they get redirected to a login/registration page, then they log in and get redirected back to the product page.

User role editor has a capability for upload files so was wondering if it can be used to download files as well.

Or should i use some other plugin or something to get this?

  • Can any logged in user download these files? Or only certain users? Nov 10, 2011 at 13:57
  • Any logged in user.
    – Corbula
    Nov 10, 2011 at 14:23

1 Answer 1


Since you're just checking to see if they are a logged in use, you can just use the is_user_logged_in() function to check if they are logged in and if so, display the download link, if not, don't display the download link.

  • Thanks, but is it possible to display the download link even if the user isn't logged in? because if a user isn't logged in and it doesn't show the download links they will just get a blank section. I want the links to show for everybody but only users that are logged in can actually view or download the files.
    – Corbula
    Nov 10, 2011 at 15:15
  • In that case, you have a couple of options, either you can create a download script that will check if the user is logged in and if so, allow the download if not, block it. Or, you can just use another plugin. I found this plugin here that I think would fit your needs. Check it out and let me know. wordpress.org/extend/plugins/download-monitor Nov 10, 2011 at 16:22
  • I've looked at the plugin and i think it will be good for a different section of the site which will be a members only download section. However it's only good for downloads uploaded with that plugin. It won't work for my needs because the files i want this to work on are uploaded via a custom field on my custom post type.
    – Corbula
    Nov 10, 2011 at 17:54
  • I'm using download monitor to get pretty much what i needed.
    – Corbula
    Nov 24, 2011 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.