WordPress.org

Make WordPress Core

Changeset 13593


Ignore:
Timestamp:
03/05/10 12:45:24 (4 years ago)
Author:
dd32
Message:

Add an update count bubble to the Updates menu. See #12517

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r13591 r13593  
    5050        $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' ); 
    5151     
    52     if ( is_super_admin() ) 
    53         $submenu[ 'index.php' ][10] = array( __('Updates'), 'install_plugins',  'update-core.php'); 
     52    if ( is_super_admin() ) { 
     53        $update_count = 0; 
     54        $update_plugins = get_site_transient( 'update_plugins' ); 
     55        if ( !empty($update_plugins->response) ) 
     56            $update_count += count( $update_plugins->response ); 
     57        $update_themes = get_site_transient( 'update_themes' ); 
     58        if ( !empty($update_themes->response) ) 
     59            $update_count += count( $update_themes->response ); 
     60        $update_wordpress = get_core_updates( array('dismissed' => false) ); 
     61        if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array(/*'development',*/ 'latest') ) ) // @TODO: Do we count Development installs as having an update available? 
     62            $update_count++; 
     63 
     64        unset($update_plugins, $update_themes, $update_wordpress); 
     65 
     66        $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php'); 
     67    } 
    5468} 
    5569 
Note: See TracChangeset for help on using the changeset viewer.