Restrict Author role to pick from media library, but not upload media

I have a multisite network where the super admins will be creating the individual sites. An important role we need to enable, for compliance reasons, is to restrict "Authors" to not be able to upload media, but be able to access the media library to choose from media that is uploaded by the super admin. I have downloaded the User Role Editor plugin, which is a great plugin btw, but the only option it gives is to turn off the "upload_files" function. That takes away all ability to access the media library. No bueno.

Anyone wanna take a stab at this??

    Mason

    Hiya,

    That's a tough one. Unfortunately, the upload_files is the only capability associated with the media library.

    So, you could go to Network Settings and remove all file types from the Upload Settings. This will make it so that there's a security error message when anyone tries to upload a file. Of course, this will also apply to you as the admin.

    I found the following script that would filter upload types for those that aren't admins, but you'd have to replace the array with nothing:

    add_filter(‘upload_mimes’,'restrict_mime’);
    function restrict_mime($mimes) {
    if(!current_user_can(‘administrator’)){
    $mimes = array(
    ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
    ‘gif’ => ‘image/gif’,
    );
    return $mimes;
    {
    }

    Hope something here helps. Thanks!

    Timothy Bowers

    Hey there!

    Just checking in to see how things are going with this one and if you need any further help.

    We haven't heard from you on this thread for a while, perhaps you got help over our email. I'm going to presume your all fixed up now and don't need any further assistance.

    However if you have more questions or need some more help then please feel free to respond in this thread or create a new one and we will be more than happy to offer assistance.

    Take care.