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
    • DEV MAN’s Sidekick


    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:

    function restrict_mime($mimes) {
    $mimes = array(
    ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
    ‘gif’ => ‘image/gif’,
    return $mimes;

    Hope something here helps. Thanks!

  • Timothy
    • Chief Pigeon

    Hey there! :slight_smile:

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

    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. :slight_smile:

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.