Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
do you perhaps mean downloads instead of uploads? Site-admin uploads files that become available for download for certain logged-in users? –  Piet Jun 21 '11 at 0:06
    
Yes; in WordPress nomenclature, uploads - like documents - are also available for download by users and can be called downloads, too. –  songdogtech Jun 21 '11 at 0:37
add comment

1 Answer

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.

share|improve this answer
    
I need to restrict certain uploads to certain users, not all uploads to some users. –  songdogtech Jun 21 '11 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" –  Piet Jun 21 '11 at 15:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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