Revise admin bar items based on user testing. Post at http://wp.me/pbNCB-qz. see #18197.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2011-10-05 18:45:32 +00:00
parent bc3fc076e1
commit dcf34868ed
3 changed files with 118 additions and 78 deletions

View File

@ -21,10 +21,6 @@ if ( !defined('ABSPATH') )
$upgrade = apply_filters( 'update_footer', '' ); $upgrade = apply_filters( 'update_footer', '' );
$footer_text = array( $footer_text = array(
'<span id="footer-thankyou">' . __( 'Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.' ) . '</span>', '<span id="footer-thankyou">' . __( 'Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.' ) . '</span>',
__( '<a href="http://codex.wordpress.org/">Documentation</a>' ),
sprintf( '<a href="%s">' . __( 'Freedoms' ) . '</a>', admin_url( 'freedoms.php' ) ),
__('<a href="http://wordpress.org/support/forum/requests-and-feedback">Feedback</a>'),
sprintf( '<a href="%s">' . __('Credits') . '</a>', admin_url('credits.php') ),
); );
echo apply_filters( 'admin_footer_text', implode( ' &bull; ', $footer_text ) ); echo apply_filters( 'admin_footer_text', implode( ' &bull; ', $footer_text ) );
unset( $footer_text ); unset( $footer_text );

View File

@ -91,17 +91,51 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
) ); ) );
} }
// Add codex link // Add freedoms link
$wp_admin_bar->add_menu( array( $wp_admin_bar->add_menu( array(
'parent' => 'wp-logo', 'parent' => 'wp-logo',
'id' => 'freedoms',
'title' => __('Freedoms'),
'href' => admin_url('freedoms.php'),
) );
// Add credits link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'credits',
'title' => __('Credits'),
'href' => admin_url('credits.php'),
) );
// Add secondary menu.
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo',
'id' => 'wp-logo-secondary',
'title' => __( '&nbsp;' ),
'meta' => array(
'class' => 'secondary',
),
) );
// Add codex link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo-secondary',
'id' => 'documentation', 'id' => 'documentation',
'title' => __('Documentation'), 'title' => __('Documentation'),
'href' => 'http://codex.wordpress.org', 'href' => 'http://codex.wordpress.org',
) ); ) );
// Add feedback link
$wp_admin_bar->add_menu( array(
'parent' => 'wp-logo-secondary',
'id' => 'feedback',
'title' => __('Feedback'),
'href' => 'http://wordpress.org/support/forum/requests-and-feedback',
) );
// Add forums link // Add forums link
$wp_admin_bar->add_menu( array( $wp_admin_bar->add_menu( array(
'parent' => 'wp-logo', 'parent' => 'wp-logo-secondary',
'id' => 'support-forums', 'id' => 'support-forums',
'title' => __('Support Forums'), 'title' => __('Support Forums'),
'href' => 'http://wordpress.org/support/', 'href' => 'http://wordpress.org/support/',
@ -109,7 +143,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
// Add WordPress.org link // Add WordPress.org link
$wp_admin_bar->add_menu( array( $wp_admin_bar->add_menu( array(
'parent' => 'wp-logo', 'parent' => 'wp-logo-secondary',
'id' => 'wporg', 'id' => 'wporg',
'title' => __('WordPress.org'), 'title' => __('WordPress.org'),
'href' => 'http://wordpress.org', 'href' => 'http://wordpress.org',
@ -181,35 +215,6 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
'class' => 'user-info-item', 'class' => 'user-info-item',
), ),
) ); ) );
$wp_admin_bar->add_menu( array(
'parent' => 'my-account',
'id' => 'my-account-secondary',
'title' => '&nbsp;',
'meta' => array(
'class' => 'secondary',
),
) );
}
wp_admin_bar_my_sites_menu( $wp_admin_bar );
}
/**
* Add the "Network Admin" menu.
*
* @since 3.3.0
*/
function wp_admin_bar_network_admin_menu( $wp_admin_bar ) {
if ( is_multisite() && is_super_admin() && ! is_network_admin() ) {
$wp_admin_bar->add_menu( array(
'id' => 'network-admin',
'title' => __('Network Admin'),
'href' => network_admin_url(),
'meta' => array(
'class' => 'opposite',
),
) );
} }
} }
@ -279,6 +284,13 @@ function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
'title' => $title_excerpt, 'title' => $title_excerpt,
'href' => $url, 'href' => $url,
) ); ) );
$wp_admin_bar->add_menu( array(
'parent' => 'blog-name',
'id' => 'view-site',
'title' => __( 'Visit Site' ),
'href' => home_url(),
) );
} }
/** /**
@ -289,7 +301,40 @@ function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
global $wpdb; global $wpdb;
if ( is_user_logged_in() ) { // Don't show for logged out users or single site mode.
if ( ! is_user_logged_in() || ! is_multisite() )
return;
// Show only when there are more than two items in the menu.
if ( count( $wp_admin_bar->user->blogs ) <= 1 && ! is_super_admin() )
return;
$wp_admin_bar->add_menu( array(
'id' => 'my-sites',
'title' => __( 'My Sites' ),
'href' => admin_url( 'my-sites.php' ),
) );
if ( is_super_admin() ) {
$wp_admin_bar->add_menu( array(
'parent' => 'my-sites',
'id' => 'network-admin',
'title' => __('Network Admin'),
'href' => network_admin_url(),
) );
}
if ( $wp_admin_bar->user->blogs ) {
$wp_admin_bar->add_menu( array(
'parent' => 'my-sites',
'id' => 'my-sites-secondary',
'title' => '&nbsp;',
'meta' => array(
'class' => 'secondary',
),
) );
}
// Add blog links // Add blog links
$blue_wp_logo_url = includes_url('images/wpmini-blue.png'); $blue_wp_logo_url = includes_url('images/wpmini-blue.png');
@ -307,7 +352,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
$menu_id = 'blog-' . $blog->userblog_id; $menu_id = 'blog-' . $blog->userblog_id;
$wp_admin_bar->add_menu( array( $wp_admin_bar->add_menu( array(
'parent' => 'my-account-secondary', 'parent' => 'my-sites-secondary',
'id' => $menu_id, 'id' => $menu_id,
'title' => $blavatar . $blogname, 'title' => $blavatar . $blogname,
'href' => get_admin_url( $blog->userblog_id ), 'href' => get_admin_url( $blog->userblog_id ),
@ -342,7 +387,6 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
'href' => get_home_url( $blog->userblog_id ), 'href' => get_home_url( $blog->userblog_id ),
) ); ) );
} }
}
} }
/** /**

View File

@ -175,12 +175,12 @@ class WP_Admin_Bar {
function add_menus() { function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 ); add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 ); add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 ); add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 ); add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
add_action( 'admin_bar_menu', 'wp_admin_bar_network_admin_menu', 80 );
if ( ! is_admin() ) { if ( ! is_admin() ) {
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_front_menu', 25 ); add_action( 'admin_bar_menu', 'wp_admin_bar_blog_front_menu', 25 );