+ case 'unfiltered_upload':
+ if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) )
+ $caps[] = $cap;
+ else
+ $caps[] = 'do_not_allow';
+ break;
+ case 'edit_files':
+ case 'edit_plugins':
+ case 'edit_themes':
+ if ( defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT ) {
+ $caps[] = 'do_not_allow';
+ break;
+ }
+ // Fall through if not DISALLOW_FILE_EDIT.
+ case 'update_plugins':
+ case 'delete_plugins':
+ case 'install_plugins':
+ case 'update_themes':
+ case 'delete_themes':
+ case 'install_themes':
+ case 'update_core':
+ // Disallow anything that creates, deletes, or edits core, plugin, or theme files.
+ // Files in uploads are excepted.
+ if ( defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS ) {
+ $caps[] = 'do_not_allow';
+ break;
+ }
+ // Fall through if not DISALLOW_FILE_MODS.
+ case 'unfiltered_html':
+ // Disallow unfiltered_html for all users, even admins and super admins.
+ if ( defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML ) {
+ $caps[] = 'do_not_allow';
+ break;
+ }
+ // Fall through if not DISALLOW_UNFILTERED_HTML
+ case 'delete_user':
+ case 'delete_users':
+ // If multisite these caps are allowed only for super admins.
+ if ( is_multisite() && !is_super_admin( $user_id ) ) {
+ $caps[] = 'do_not_allow';
+ } else {
+ if ( 'delete_user' == $cap )
+ $cap = 'delete_users';
+ $caps[] = $cap;
+ }
+ break;
+ case 'create_users':
+ if ( is_multisite() && !get_site_option( 'add_new_users' ) )
+ $caps[] = 'do_not_allow';
+ else
+ $caps[] = $cap;
+ break;