Just taking a rough stab at this...
add_filter('media_upload_tabs', 'modify_media_tabs');
function modify_media_tabs($tabs) {
if (is_super_admin()) return $tabs;
return array(
'type_url' => __('From URL'),
'gallery' => __('Gallery'),
'library' => __('Media Library')
);
}
add_filter('_upload_iframe_src', 'change_default_media_tab');
function change_default_media_tab($uri) {
if (is_super_admin()) return $uri;
return $uri.'&tab=library';
}
add_action('current_screen', 'check_uploading_permissions');
function check_uploading_permissions() {
if (is_super_admin()) return;
if (get_current_screen()->id == 'media-upload' || (get_current_screen()->action == 'add' && get_current_screen()->id == 'media')) {
$post_id = (int) $_GET['post_id'];
if (!$post_id || isset($_GET['inline']))
wp_die(__('You do not have permission to upload files.'));
if ( !isset($_GET['tab']) || !($_GET['tab'] == 'library' || $_GET['tab'] == 'type_url' || $_GET['tab'] == 'gallery')) {
wp_redirect( admin_url('media-upload.php?tab=library&post_id='.$post_id) );
exit;
}
}
}
We're doing 3 things:
- Removing the "My computer" tab from the editor's popup uploader
- We're making the default tab "Library" in the editor's popup uploader
- We're denying permission to direct access to the media upload pages
I did this for anyone who isn't a super admin, but of course, you can add in a clause for other capabilities instead. I didn't try POSTing an image to see if it's bypass-able, so if compliance is your game, you'd want to do that. In fact, while it may go without saying, I'll say it anyway:
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Hope this helps!
Cheers~