From a7fcc6f4deaaf425369eee6a459ac27db79c91b9 Mon Sep 17 00:00:00 2001 From: dd32 Date: Fri, 5 Mar 2010 12:45:24 +0000 Subject: [PATCH] Add an update count bubble to the Updates menu. See #12517 git-svn-id: http://svn.automattic.com/wordpress/trunk@13593 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index fb265544ad..4ca140bd52 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -49,8 +49,22 @@ if ( is_multisite() || is_super_admin() ) { if ( is_multisite() ) $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' ); - if ( is_super_admin() ) - $submenu[ 'index.php' ][10] = array( __('Updates'), 'install_plugins', 'update-core.php'); + if ( is_super_admin() ) { + $update_count = 0; + $update_plugins = get_site_transient( 'update_plugins' ); + if ( !empty($update_plugins->response) ) + $update_count += count( $update_plugins->response ); + $update_themes = get_site_transient( 'update_themes' ); + if ( !empty($update_themes->response) ) + $update_count += count( $update_themes->response ); + $update_wordpress = get_core_updates( array('dismissed' => false) ); + if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array(/*'development',*/ 'latest') ) ) // @TODO: Do we count Development installs as having an update available? + $update_count++; + + unset($update_plugins, $update_themes, $update_wordpress); + + $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "" . number_format_i18n($update_count) . "" ), 'install_plugins', 'update-core.php'); + } } $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );