From 6aabfcb1a80615b48baf222f4761fb4375f9652b Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 9 Feb 2010 00:07:52 +0000 Subject: [PATCH] Introduce DISALLOW_FILE_EDIT flag for enabling/disabling the theem and plugin editors. Props nacin. see #11306 git-svn-id: http://svn.automattic.com/wordpress/trunk@13034 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index dcd308e16..03e903571 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -975,19 +975,24 @@ function map_meta_cap( $cap, $user_id ) { $caps[] = 'read_private_pages'; break; case 'unfiltered_upload': - if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS == true && ( !is_multisite() || is_super_admin() ) ) + if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin() ) ) $caps[] = $cap; else $caps[] = 'do_not_allow'; break; + 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 'unfiltered_html': case 'update_plugins': case 'delete_plugins': case 'install_plugins': - case 'edit_plugins': case 'update_themes': case 'install_themes': - case 'edit_themes': case 'update_core': case 'delete_user': case 'delete_users':