From ec0b1234a9d7b43a79732057b0e52c8a5cf0d37c Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 17 Jun 2010 15:57:02 +0000 Subject: [PATCH] Allow only super admins to see plugins.php if the Plugins menu is not exposed. Props ocean90. fixes #13944 git-svn-id: http://svn.automattic.com/wordpress/trunk@15271 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/plugins.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index b93172aca3..e83ca4c9d9 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -8,6 +8,14 @@ /** WordPress Administration Bootstrap */ require_once('./admin.php'); +if ( is_multisite() ) { + $menu_perms = get_site_option( 'menu_items', array() ); + + if ( empty($menu_perms['plugins']) && ! is_super_admin() ) + wp_die( __( 'Cheatin’ uh?' ) ); + else if ( $menu_perms['plugins'] != 1 && is_super_admin() ) + add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' ); +} if ( ! current_user_can( 'activate_plugins' ) ) wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) ); @@ -315,13 +323,6 @@ add_contextual_help($current_screen, '

' . __('Support Forums') . '

' ); -if ( is_multisite() && is_super_admin() ) { - $menu_perms = get_site_option('menu_items', array()); - if ( empty($menu_perms['plugins']) ) - add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' ); - unset($menu_perms); -} - $title = __('Plugins'); require_once('./admin-header.php');