[wp-edu] Making media library files private

Stas Sușcov stas at nerd.ro
Mon Mar 5 14:38:15 UTC 2012


În data de Mon, 05 Mar 2012 16:24:28 +0200, Grogan, David  
<David.Grogan at tufts.edu> a scris:

> Hello all,
>
> We have a large multi-site instance of WP 3.3.1 and although you can  
> make your WordPress site private to individual named accounts (e.g. try  
> accessing http://sites.tufts.edu/dgtest) it's really only the posts and  
> pages content that is private. Any content uploaded to the sites Media  
> Library (e.g. documents, images, audio etc) is still publicly accessible  
> (e.g. try accessing:  
> http://sites.tufts.edu/dgtest/wp-content/blogs.dir/856/files/2012/03/FCKeditor.png).
>
> Has anyone come across a solution that will provide privacy to the media  
> library files?
>

You might want to take a look at this little plugin:
http://wordpress.org/extend/plugins/uploads/

It can mask uploaded files location.

For even more security, I suggest extracting these two methods from  
Coursewa.re project:
https://github.com/scholarpress/buddypress-courseware/blob/master/groups/groups.class.php#L302

Make sure you hook into `media_upload_form_url`.
Ex.:
add_filter( 'media_upload_form_url', array( __CLASS__, 'media_library_tab'  
) );

This should filter available media items by logged-in `user_id`.


More information about the wp-edu mailing list