Does any one knows a valid/standard way to disable drag and upload when accessing the media library in the admin area? In order to make this sense to you, I'm building a multisite and user of sub-site cannot upload media files but they can view.
I can remove their capability 'upload_file' but that would completely remove the media experience.
So far this is what I've got:
add_action('admin_init','disable_drag_upload');
function disable_drag_upload() {
wp_deregister_script( 'wp-plupload' );
}
.. but that would skip the media library content.
upload_file
capability. I think that is a must, not an option. Then you can create a custom page to display the media files, nothing stop you, but a user with a capability that he/she can not perform is actually a very bad approach; it can give more headache than happiness; who knows when any other piece of code based on capabilities and will cause conflicts with your intention. I hope you understand my point.upload_file
, means customizing them all. That's the standard approach but not practical as it would take re-inventing what's already been designed. It's worth suggesting to the core to add something likeview_file
capability though, but until that timewp_handle_upload_prefilter
provides a valid way atm.view_file
capability for media files (similar toread
for posts) is worthless. Actually, in WordPress environment, all media files can be read and viewed by any one because the file URL is publicly accessible.