WordPress.org

Make WordPress Core

Changeset 17588


Ignore:
Timestamp:
04/03/11 08:59:01 (3 years ago)
Author:
dd32
Message:

Hide update bubble counts for users who can't perform the update. Props garyc40 for initial patch. Fixes #14447

File:
1 edited

Legend:

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

    r17431 r17588  
    3434    $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 
    3535    $update_plugins = get_site_transient( 'update_plugins' ); 
    36     if ( !empty($update_plugins->response) ) 
     36    if ( !empty($update_plugins->response) && current_user_can('update_plugins') ) 
    3737        $plugin_update_count = count( $update_plugins->response ); 
    3838    $update_themes = get_site_transient( 'update_themes' ); 
    39     if ( !empty($update_themes->response) ) 
     39    if ( !empty($update_themes->response) && current_user_can('update_themes') ) 
    4040        $theme_update_count = count( $update_themes->response ); 
    4141    $update_wordpress = get_core_updates( array('dismissed' => false) ); 
    42     if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 
     42    if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) 
    4343        $wordpress_update_count = 1; 
    4444 
     
    172172if ( ! is_multisite() || is_super_admin() || ! empty( $menu_perms['plugins'] ) ) { 
    173173    $count = "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>"; 
    174     if ( is_multisite() ) 
     174    if ( is_multisite() || ! current_user_can( 'update_plugins' ) ) 
    175175        $count = ''; 
    176176    $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' ); 
Note: See TracChangeset for help on using the changeset viewer.