Move some multisite menu checks directly into menu.php. see #11763

git-svn-id: https://develop.svn.wordpress.org/trunk@12613 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-01-06 23:41:03 +00:00
parent 03f8d8996d
commit d710ef45d0
2 changed files with 19 additions and 20 deletions

View File

@ -551,22 +551,6 @@ add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
function wpmu_menu() { function wpmu_menu() {
global $menu, $submenu, $current_user; global $menu, $submenu, $current_user;
if( is_site_admin() ) {
$menu[1] = array( '', 'read', '', '', 'wp-menu-separator' );
$menu[2] = array(__('Site Admin'), '10', 'wpmu-admin.php', '', 'menu-top menu-top-first', 'menu-site', 'div');
$submenu[ 'wpmu-admin.php' ][1] = array( __('Admin'), '10', 'wpmu-admin.php' );
$submenu[ 'wpmu-admin.php' ][5] = array( __('Blogs'), '10', 'wpmu-blogs.php' );
$submenu[ 'wpmu-admin.php' ][10] = array( __('Users'), '10', 'wpmu-users.php' );
$submenu[ 'wpmu-admin.php' ][20] = array( __('Themes'), '10', 'wpmu-themes.php' );
$submenu[ 'wpmu-admin.php' ][25] = array( __('Options'), '10', 'wpmu-options.php' );
$submenu[ 'wpmu-admin.php' ][30] = array( __('Upgrade'), '10', 'wpmu-upgrade-site.php' );
}
if( !is_site_admin() )
unset( $submenu['plugins.php'][10] ); // always remove the plugin installer for regular users
unset( $submenu['plugins.php'][15] ); // always remove the plugin editor
unset( $submenu['themes.php'][10] ); // always remove the themes editor
$menu_perms = get_site_option( "menu_items" ); $menu_perms = get_site_option( "menu_items" );
if( is_array( $menu_perms ) == false ) if( is_array( $menu_perms ) == false )
$menu_perms = array(); $menu_perms = array();

View File

@ -27,6 +27,17 @@ $awaiting_mod = $awaiting_mod->moderated;
$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' ); $menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
if ( is_multisite() && is_super_admin() ) {
$menu[1] = array( '', 'read', 'separator0', '', 'wp-menu-separator' );
$menu[2] = array(__('Site Admin'), '10', 'ms-admin.php', '', 'menu-top menu-top-first', 'menu-site', 'div');
$submenu[ 'ms-admin.php' ][1] = array( __('Admin'), 'delete_users', 'ms-admin.php' );
$submenu[ 'ms-admin.php' ][5] = array( __('Blogs'), 'delete_users', 'ms-blogs.php' );
$submenu[ 'ms-admin.php' ][10] = array( __('Users'), 'delete_users', 'ms-users.php' );
$submenu[ 'ms-admin.php' ][20] = array( __('Themes'), 'delete_users', 'ms-themes.php' );
$submenu[ 'ms-admin.php' ][25] = array( __('Options'), 'delete_users', 'ms-options.php' );
$submenu[ 'ms-admin.php' ][30] = array( __('Upgrade'), 'delete_users', 'ms-upgrade-site.php' );
}
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top', 'menu-posts', 'div' ); $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top', 'menu-posts', 'div' );
@ -88,7 +99,8 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' ); $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php'); if ( !is_multisite() )
$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
$submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php'); $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php');
$update_plugins = get_transient( 'update_plugins' ); $update_plugins = get_transient( 'update_plugins' );
@ -98,9 +110,12 @@ if ( !empty($update_plugins->response) )
$menu[65] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' ); $menu[65] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' );
$submenu['plugins.php'][5] = array( __('Installed'), 'activate_plugins', 'plugins.php' ); $submenu['plugins.php'][5] = array( __('Installed'), 'activate_plugins', 'plugins.php' );
/* translators: add new plugin */ if ( is_super_admin() ) {
$submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php'); /* translators: add new plugin */
$submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' ); $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
}
if ( !is_multisite() )
$submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );
if ( current_user_can('edit_users') ) if ( current_user_can('edit_users') )
$menu[70] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' ); $menu[70] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );