2010-09-27 16:26:36 -04:00
< ? php
/**
*
* Use the $wp_admin_bar global to add the super admin menu , providing admin options only visible to super admins .
*/
function wp_admin_bar_superadmin_settings_menu () {
global $wp_admin_bar , $current_blog , $current_user ;
/* Add the main superadmin menu item */
2010-10-28 04:31:36 -04:00
$wp_admin_bar -> add_menu ( array ( 'id' => 'superadmin' , 'title' => 'μ' , 'href' => '' , 'meta' => array ( 'class' => 'ab-sadmin' ), ) );
2010-09-27 16:26:36 -04:00
2010-10-09 08:22:00 -04:00
/* Get the settings we need for the current site */
2010-09-27 16:26:36 -04:00
$matureaction = $current_blog -> mature ? 'unmatureblog' : 'matureblog' ;
2010-10-28 04:31:36 -04:00
$maturetext_confirm = $current_blog -> mature ?
sprintf (
esc_attr__ ( 'Are you sure you want to unmark %s as mature?' ),
$current_blog -> domain
) :
sprintf (
esc_attr__ ( 'Are you sure you want to mark %s as mature?' ),
$current_blog -> domain
);
2010-09-27 16:26:36 -04:00
$suspendaction = $current_blog -> spam ? 'unspamblog' : 'spamblog' ;
2010-10-28 04:31:36 -04:00
$suspendtext_confirm = $current_blog -> spam ?
sprintf (
esc_attr__ ( 'Are you sure you want to unsuspend site %s?' ),
$current_blog -> domain
) :
sprintf (
esc_attr__ ( 'Are you sure you want to suspend site %s?' ),
$current_blog -> domain
);
$mature_url = network_admin_url ( " edit.php?action=confirm&action2= { $matureaction } &id= { $current_blog -> blog_id } &msg= " . urlencode ( $maturetext_confirm ) );
$suspend_url = network_admin_url ( " edit.php?action=confirm&action2= { $suspendaction } &id= { $current_blog -> blog_id } &msg= " . urlencode ( $suspendtext_confirm ) );
2010-09-27 16:26:36 -04:00
/* Add the submenu items to the Super Admin menu */
2010-10-29 14:12:18 -04:00
$wp_admin_bar -> add_menu ( array ( 'parent' => 'superadmin' , 'title' => __ ( 'Network Admin' ), 'href' => network_admin_url (), 'position' => 5 , ) );
$wp_admin_bar -> add_menu ( array ( 'parent' => 'superadmin' , 'title' => __ ( 'Site Admin' ), 'href' => admin_url (), 'position' => 10 , ) );
$wp_admin_bar -> add_menu ( array ( 'parent' => 'superadmin' , 'title' => __ ( 'Site Options' ), 'href' => network_admin_url ( " site-info.php?id= { $current_blog -> blog_id } " ), 'position' => 30 , ) );
2010-10-28 04:31:36 -04:00
$wp_admin_bar -> add_menu ( array ( 'parent' => 'superadmin' , 'title' => ( $current_blog -> mature ? __ ( 'Unmark as mature' ) : __ ( 'Mark as mature' ) ), 'href' => $mature_url , 'position' => 50 , ) );
$wp_admin_bar -> add_menu ( array ( 'parent' => 'superadmin' , 'title' => ( $current_blog -> spam ? __ ( 'Unsuspend site' ) : __ ( 'Suspend site' ) ), 'href' => $suspend_url , 'position' => 80 , ) );
2010-09-27 16:26:36 -04:00
}
2010-10-28 04:31:36 -04:00
?>