Created
November 2, 2012 15:50
-
-
Save stephanieleary/4002180 to your computer and use it in GitHub Desktop.
Adds plugin and theme links to the Network Admin section of the admin menu bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Add Plugins Link | |
Description: Adds plugin and theme links to the Network Admin section of the admin menu bar. | |
Author: Stephanie Leary | |
Version: 1.0 | |
Author URI: http://stephanieleary.com | |
*/ | |
add_action('admin_bar_menu', 'add_plugins_link_for_superadmins', 25); | |
function add_plugins_link_for_superadmins() { | |
global $wp_admin_bar; | |
if ( !is_user_logged_in() ) { return; } | |
if ( !is_super_admin() || !is_admin_bar_showing() ) { return; } | |
global $blog_id; | |
$user = get_current_user_id(); | |
if (is_super_admin( $user )) { | |
if ( function_exists('is_multisite') && is_multisite() ) { | |
$themes = network_admin_url( 'themes.php' ); | |
$plugins = network_admin_url( 'plugins.php' ); | |
} | |
else { | |
$themes = admin_url( 'themes.php' ); | |
$plugins = admin_url( 'plugins.php' ); | |
} | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'network-admin', | |
'id' => 'themes', | |
'title' => __('Themes'), | |
'href' => $themes ) | |
); | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'network-admin', | |
'id' => 'plugins', | |
'title' => __('Plugins'), | |
'href' => $plugins ) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment