From f781ba48247cdbb03fea292ab4471e5c59e26d45 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 2 Sep 2010 15:03:39 +0000 Subject: [PATCH] is_blog_admin(). fixes #14763 git-svn-id: http://svn.automattic.com/wordpress/trunk@15558 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 4 +++- wp-includes/load.php | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index f48827a20b..4b4b21d984 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -14,8 +14,10 @@ if ( !defined('WP_ADMIN') ) define('WP_ADMIN', TRUE); -if ( !defined('WP_NETWORK_ADMIN') ) +if ( !defined('WP_NETWORK_ADMIN') ) { define('WP_NETWORK_ADMIN', FALSE); + define('WP_BLOG_ADMIN', TRUE); +} if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) define('WP_LOAD_IMPORTERS', true); diff --git a/wp-includes/load.php b/wp-includes/load.php index f12be0aa75..05415485d0 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -553,7 +553,7 @@ function wp_clone( $object ) { } /** - * Whether the current request is in WordPress admin Panel + * Whether the current request is for a network or blog admin page * * Does not inform on whether the user is an admin! Use capability checks to * tell if the user should be accessing a section or not. @@ -569,7 +569,23 @@ function is_admin() { } /** - * Whether the current request is in WordPress network admin Panel + * Whether the current request is for a blog admin screen /wp-admin/ + * + * Does not inform on whether the user is a blog admin! Use capability checks to + * tell if the user should be accessing a section or not. + * + * @since 3.1.0 + * + * @return bool True if inside WordPress network administration pages. + */ +function is_blog_admin() { + if ( defined( 'WP_BLOG_ADMIN' ) ) + return WP_BLOG_ADMIN; + return false; +} + +/** + * Whether the current request is for a network admin screen /wp-admin/network/ * * Does not inform on whether the user is a network admin! Use capability checks to * tell if the user should be accessing a section or not.