From 9746d095d58f242af836065c003259e89bb9a953 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 19 Jan 2010 18:11:33 +0000 Subject: [PATCH] Remove disable_some_pages(). Rely on cap checks. fixes #11770 git-svn-id: http://svn.automattic.com/wordpress/trunk@12764 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ms.php | 28 ---------------------------- wp-admin/user-new.php | 3 +++ 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index f720e4c52a..e700eec967 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -1086,34 +1086,6 @@ if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) { add_action( 'admin_init', 'profile_page_email_warning_ob_start' ); } -function disable_some_pages() { - global $messages; - - if ( strpos( $_SERVER['PHP_SELF'], 'user-new.php' ) && !get_site_option( 'add_new_users' ) ) { - if ( is_super_admin() ) { - $messages[] = '

' . __( 'Warning! Only site administrators may see this page. Everyone else will see a page disabled message. Enable it again on the options page.' ) . '

'; - } else { - wp_die( __('Page disabled by the administrator') ); - } - } - - $pages = array( 'theme-editor.php', 'plugin-editor.php' ); - foreach( $pages as $page ) { - if ( strpos( $_SERVER['PHP_SELF'], $page ) ) { - wp_die( __('Page disabled by the administrator') ); - } - } - - $pages = array( 'theme-install.php', 'plugin-install.php' ); - foreach( $pages as $page ) { - if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_super_admin() ) { - wp_die( __( "Sorry, you're not allowed here." ) ); - } - } - -} -add_action( 'admin_init', 'disable_some_pages' ); - function blogs_listing_post() { if ( !isset( $_POST[ 'action' ] ) ) { return false; diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index 532fa94ed6..1f2db707d2 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -12,6 +12,9 @@ require_once('admin.php'); if ( !current_user_can('create_users') ) wp_die(__('Cheatin’ uh?')); +if ( is_multisite() && !get_site_option( 'add_new_users' ) ) + wp_die( __('Page disabled by the administrator') ); + /** WordPress Registration API */ require_once( ABSPATH . WPINC . '/registration.php');