Favorite action for network admin. see #14435

git-svn-id: https://develop.svn.wordpress.org/trunk@15489 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-08-02 19:07:03 +00:00
parent 126dc0a006
commit 01508edfac
2 changed files with 55 additions and 42 deletions

View File

@ -153,7 +153,7 @@ echo implode(' ', $links);
?></p> ?></p>
</div> </div>
<?php !is_network_admin() ? favorite_actions($current_screen) : ''; ?> <?php favorite_actions($current_screen); ?>
</div> </div>
</div> </div>

View File

@ -3326,6 +3326,9 @@ function favorite_actions( $screen = null ) {
} }
if ( !$default_action ) { if ( !$default_action ) {
if ( $screen->is_network ) {
$default_action = array('sites.php' => array( __('Sites'), 'manage_sites'));
} else {
switch ( $screen->id ) { switch ( $screen->id ) {
case 'upload': case 'upload':
$default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
@ -3363,7 +3366,9 @@ function favorite_actions( $screen = null ) {
break; break;
} }
} }
}
if ( !$screen->is_network ) {
$actions = array( $actions = array(
'post-new.php' => array(__('New Post'), 'edit_posts'), 'post-new.php' => array(__('New Post'), 'edit_posts'),
'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
@ -3371,6 +3376,12 @@ function favorite_actions( $screen = null ) {
'media-new.php' => array(__('Upload'), 'upload_files'), 'media-new.php' => array(__('Upload'), 'upload_files'),
'edit-comments.php' => array(__('Comments'), 'moderate_comments') 'edit-comments.php' => array(__('Comments'), 'moderate_comments')
); );
} else {
$actions = array(
'sites.php' => array( __('Sites'), 'manage_sites'),
'users.php' => array( __('Users'), 'manage_network_users')
);
}
$default_key = array_keys($default_action); $default_key = array_keys($default_action);
$default_key = $default_key[0]; $default_key = $default_key[0];
@ -3946,6 +3957,8 @@ function set_current_screen( $id = '' ) {
$current_screen->taxonomy = $taxnow; $current_screen->taxonomy = $taxnow;
} }
$current_screen->is_network = is_network_admin() ? true : false;
$current_screen = apply_filters('current_screen', $current_screen); $current_screen = apply_filters('current_screen', $current_screen);
} }