From 411594ffd89e71ec02be356eefb4d5d27ad1a321 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 19 Jan 2010 18:11:33 +0000 Subject: [PATCH] Remove disable_some_pages(). Rely on cap checks. fixes #11770 git-svn-id: https://develop.svn.wordpress.org/trunk@12764 602fd350-edb4-49c9-b593-d223f7449a82 --- 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');