1

This is a very open-ended, speculative question with lots of possible angles: has anyone worked with ways to restrict the access of certain uploads to a logged in user?

I.e., how can the site admin upload files and assign permissions to each one for certain logged-in users?

Could this entail an uploads directory called /this_user/ in wp-content/uploads/? And restrict access to that with .htaccess and is_logged_in? Or some kind of meta or custom field that assigns permissions and users for uploads?

Other answers here on WPAnswers deal with hotlinking protection, which is a different situation; I need to restrict to logged in users, all on the same domain.

Any ideas? Thanks

2
  • do you perhaps mean downloads instead of uploads? Site-admin uploads files that become available for download for certain logged-in users?
    – user2015
    Jun 21, 2011 at 0:06
  • Yes; in WordPress nomenclature, uploads - like documents - are also available for download by users and can be called downloads, too. Jun 21, 2011 at 0:37

1 Answer 1

1

You can use current_user_has_role for this

And if the standard roles are not enough for you, then I would suggest to download the Members plugin by Justin Tadlock which enables you to add roles.

2
  • I need to restrict certain uploads to certain users, not all uploads to some users. Jun 21, 2011 at 14:52
  • and that is why I said that you could download the Members plugin. With that plugin you create a new role and you give that role to "certain users"
    – user2015
    Jun 21, 2011 at 15:23

Your Answer

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

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