From 3f25a734557aa4731dfa013b0fbe99cc4eacd710 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 22 Apr 2009 01:30:15 +0000 Subject: [PATCH] When on manage page, default favorite actions to the correspoding create page. git-svn-id: http://svn.automattic.com/wordpress/trunk@11043 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 2 +- wp-admin/includes/template.php | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 43aaaf357..f15c9422a 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -110,7 +110,7 @@ if ( function_exists('mb_strlen') ) {

- + diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 44d11661a..f0799c86c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -3187,7 +3187,31 @@ function the_post_password() { * * @since unknown */ -function favorite_actions() { +function favorite_actions( $screen = null ) { + switch ( $screen ) { + case 'edit-pages.php': + $default_action = array('page-new.php' => array(__('New Page'), 'edit_pages')); + break; + case 'upload.php': + $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); + break; + case 'link-manager.php': + $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); + break; + case 'users.php': + $default_action = array('user-new.php' => array(__('New User'), 'create_users')); + break; + case 'plugins.php': + $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); + break; + case 'themes.php': + $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); + break; + default: + $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); + break; + } + $actions = array( 'post-new.php' => array(__('New Post'), 'edit_posts'), 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), @@ -3196,6 +3220,11 @@ function favorite_actions() { 'edit-comments.php' => array(__('Comments'), 'moderate_comments') ); + $default_key = array_keys($default_action); + $default_key = $default_key[0]; + if ( isset($actions[$default_key]) ) + unset($actions[$default_key]); + $actions = array_merge($default_action, $actions); $actions = apply_filters('favorite_actions', $actions); $allowed_actions = array();