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,51 +3326,62 @@ function favorite_actions( $screen = null ) {
} }
if ( !$default_action ) { if ( !$default_action ) {
switch ( $screen->id ) { if ( $screen->is_network ) {
case 'upload': $default_action = array('sites.php' => array( __('Sites'), 'manage_sites'));
$default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); } else {
break; switch ( $screen->id ) {
case 'media': case 'upload':
$default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
break; break;
case 'link-manager': case 'media':
case 'link': $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
if ( 'add' != $screen->action ) break;
$default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); case 'link-manager':
else case 'link':
$default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); if ( 'add' != $screen->action )
break; $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
case 'users': else
$default_action = array('user-new.php' => array(__('New User'), 'create_users')); $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
break; break;
case 'user': case 'users':
$default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
break; break;
case 'plugins': case 'user':
$default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
break; break;
case 'plugin-install': case 'plugins':
$default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
break; break;
case 'themes': case 'plugin-install':
$default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
break; break;
case 'theme-install': case 'themes':
$default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
break; break;
default: case 'theme-install':
$default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
break; break;
default:
$default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
break;
}
} }
} }
$actions = array( if ( !$screen->is_network ) {
'post-new.php' => array(__('New Post'), 'edit_posts'), $actions = array(
'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), 'post-new.php' => array(__('New Post'), 'edit_posts'),
'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'), 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
'media-new.php' => array(__('Upload'), 'upload_files'), 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),
'edit-comments.php' => array(__('Comments'), 'moderate_comments') 'media-new.php' => array(__('Upload'), 'upload_files'),
'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);
} }