Ticket #25219: 25219.5.diff
File 25219.5.diff, 23.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/class-wp-plugins-list-table.php
97 97 if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) 98 98 $plugins['dropins'] = get_dropins(); 99 99 100 if ( current_user_can( ' update_plugins' ) ) {100 if ( current_user_can( 'view_plugin_updates' ) ) { 101 101 $current = get_site_transient( 'update_plugins' ); 102 102 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 103 103 if ( isset( $current->response[ $plugin_file ] ) ) { -
src/wp-admin/includes/theme.php
125 125 */ 126 126 function get_theme_update_available( $theme ) { 127 127 static $themes_update; 128 129 if ( ! current_user_can('update_themes' ) )128 129 if ( ! current_user_can( 'view_theme_updates' ) ) { 130 130 return false; 131 131 } 132 132 133 if ( !isset($themes_update) ) 133 134 $themes_update = get_site_transient('update_themes'); 134 135 … … 398 399 } 399 400 400 401 $updates = array(); 401 if ( current_user_can( ' update_themes' ) ) {402 if ( current_user_can( 'view_theme_updates' ) ) { 402 403 $updates_transient = get_site_transient( 'update_themes' ); 403 404 if ( isset( $updates_transient->response ) ) { 404 405 $updates = $updates_transient->response; -
src/wp-admin/includes/update.php
160 160 } 161 161 162 162 function core_update_footer( $msg = '' ) { 163 if ( ! current_user_can('update_core') )163 if ( ! current_user_can( 'view_core_updates' ) ) 164 164 return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); 165 165 166 166 $cur = get_preferred_from_update_core(); … … 181 181 return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) ); 182 182 183 183 case 'upgrade' : 184 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current); 184 if ( current_user_can( 'update_core' ) ) { 185 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current); 186 } else { 187 return sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.'), $cur->current ); 188 } 185 189 186 190 case 'latest' : 187 191 default : … … 206 210 207 211 if ( current_user_can('update_core') ) { 208 212 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) ); 213 } elseif ( current_user_can( 'view_core_updates' ) ) { 214 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.'), $cur->current ); 209 215 } else { 210 216 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current ); 211 217 } … … 223 229 224 230 $msg = sprintf( __( 'WordPress %1$s running %2$s theme.' ), get_bloginfo( 'version', 'display' ), $theme_name ); 225 231 226 if ( current_user_can( 'update_core') ) {232 if ( current_user_can( 'view_core_updates' ) ) { 227 233 $cur = get_preferred_from_update_core(); 228 234 229 if ( isset( $cur->response ) && $cur->response == 'upgrade' ) 230 $msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>'; 235 if ( isset( $cur->response ) && $cur->response == 'upgrade' ) { 236 if ( current_user_can( 'update_core' ) ) { 237 $msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>'; 238 } else { 239 $msg .= ' ' . sprintf( __( '<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please update now.' ), $cur->current ); 240 } 241 } 231 242 } 232 243 233 244 echo "<p id='wp-version-message'>$msg</p>"; … … 248 259 } 249 260 250 261 function wp_plugin_update_rows() { 251 if ( ! current_user_can('update_plugins' ) )262 if ( ! current_user_can( 'view_plugin_updates' ) ) { 252 263 return; 264 } 253 265 254 266 $plugins = get_site_transient( 'update_plugins' ); 255 267 if ( isset($plugins->response) && is_array($plugins->response) ) { -
src/wp-admin/menu.php
34 34 $update_data = wp_get_update_data(); 35 35 36 36 if ( ! is_multisite() ) { 37 if ( current_user_can( ' update_core' ) )38 $cap = ' update_core';39 elseif ( current_user_can( ' update_plugins' ) )40 $cap = ' update_plugins';37 if ( current_user_can( 'view_core_updates' ) ) 38 $cap = 'view_core_updates'; 39 elseif ( current_user_can( 'view_plugin_updates' ) ) 40 $cap = 'view_plugin_updates'; 41 41 else 42 $cap = ' update_themes';42 $cap = 'view_theme_updates'; 43 43 $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php'); 44 44 unset( $cap ); 45 45 } … … 168 168 } 169 169 170 170 $count = ''; 171 if ( ! is_multisite() && current_user_can( ' update_plugins' ) ) {171 if ( ! is_multisite() && current_user_can( 'view_plugin_updates' ) ) { 172 172 if ( ! isset( $update_data ) ) 173 173 $update_data = wp_get_update_data(); 174 174 $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>"; … … 180 180 181 181 if ( ! is_multisite() ) { 182 182 /* translators: add new plugin */ 183 $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), ' install_plugins', 'plugin-install.php' );183 $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'view_plugin_updates', 'plugin-install.php' ); 184 184 $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); 185 185 } 186 186 -
src/wp-admin/plugin-install.php
14 14 */ 15 15 require_once( dirname( __FILE__ ) . '/admin.php' ); 16 16 17 if ( ! current_user_can( 'install_plugins') )18 wp_die( __('You do not have sufficient permissions to install plugins on this site.'));17 if ( ! current_user_can( 'view_plugin_updates' ) ) 18 wp_die( __( 'You do not have sufficient permissions to view plugin updates for this site.' ) ); 19 19 20 20 if ( is_multisite() && ! is_network_admin() ) { 21 21 wp_redirect( network_admin_url( 'plugin-install.php' ) ); -
src/wp-admin/update-core.php
19 19 exit(); 20 20 } 21 21 22 if ( ! current_user_can( ' update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )23 wp_die( __( 'You do not have sufficient permissions to updatethis site.' ) );22 if ( ! current_user_can( 'view_core_updates' ) && ! current_user_can( 'view_theme_updates' ) && ! current_user_can( 'view_plugin_updates' ) ) 23 wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) ); 24 24 25 25 function list_core_update( $update ) { 26 26 global $wp_local_package, $wpdb, $wp_version; … … 63 63 $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); 64 64 elseif ( !$mysql_compat ) 65 65 $message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); 66 else 67 $message = sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); 66 else { 67 if ( current_user_can( 'update_core' ) ) { 68 $message = sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); 69 } else { 70 $message = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> is available. Please download the package and install it manually.'), $update->current, $version_string); 71 } 72 } 68 73 if ( !$mysql_compat || !$php_compat ) 69 74 $show_buttons = false; 70 75 } … … 80 85 echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; 81 86 echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; 82 87 if ( $show_buttons ) { 83 if ( $first_pass ) { 84 submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false ); 85 $first_pass = false; 86 } else { 87 submit_button( $submit, 'button', 'upgrade', false ); 88 if ( current_user_can( 'update_core' ) ) { 89 if ( $first_pass ) { 90 submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false ); 91 $first_pass = false; 92 } else { 93 submit_button( $submit, 'button', 'upgrade', false ); 94 } 95 echo ' '; 88 96 } 89 echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> ';97 echo '<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; 90 98 } 91 99 if ( 'en_US' != $update->locale ) 92 100 if ( !isset( $update->dismissed ) || !$update->dismissed ) … … 189 197 } 190 198 echo '</ul>'; 191 199 // Don't show the maintenance mode notice when we are only showing a single re-install option. 192 if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {200 if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) && current_user_can( 'update_core' ) ) { 193 201 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; 194 202 } elseif ( ! $updates ) { 195 203 list( $normalized_version ) = explode( '-', $wp_version ); … … 219 227 $core_update_version = $core_updates[0]->current; 220 228 ?> 221 229 <h3><?php _e( 'Plugins' ); ?></h3> 222 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> 223 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> 224 <?php wp_nonce_field('upgrade-core'); ?> 225 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> 230 <p> 231 <?php _e( 'The following plugins have new versions available.' ); ?> 232 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 233 <?php _e( 'Check the ones you want to update and then click “Update Plugins”.' ); ?> 234 <?php endif; ?> 235 </p> 236 237 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 238 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> 239 <?php wp_nonce_field('upgrade-core'); ?> 240 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> 241 <?php endif; ?> 242 226 243 <table class="widefat" id="update-plugins-table"> 227 <thead> 228 <tr> 229 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th> 230 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th> 231 </tr> 232 </thead> 233 234 <tfoot> 235 <tr> 236 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th> 237 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th> 238 </tr> 239 </tfoot> 244 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 245 <thead> 246 <tr> 247 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th> 248 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th> 249 </tr> 250 </thead> 251 252 <tfoot> 253 <tr> 254 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th> 255 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th> 256 </tr> 257 </tfoot> 258 <?php endif; ?> 259 240 260 <tbody class="plugins"> 241 261 <?php 242 262 foreach ( (array) $plugins as $plugin_file => $plugin_data) { … … 270 290 $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version); 271 291 $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text); 272 292 273 echo " 274 <tr> 275 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> 276 <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td> 277 </tr>"; 293 ?> 294 <tr> 295 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 296 <th scope="row" class="check-column"><input type="checkbox" name="checked[]" value="<?php esc_attr_e( $plugin_file ); ?>" /></th> 297 <?php endif; ?> 298 299 <td> 300 <p> 301 <strong><?php echo $plugin_data->Name; ?></strong><br /> 302 <?php printf( __( 'You have version %s installed.' ), $plugin_data->Version ); ?> 303 304 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 305 <?php printf( __( 'Update to %s.' ), $plugin_data->update->new_version ); ?> 306 <?php else : ?> 307 <?php printf( __( '%s is available.' ), $plugin_data->update->new_version ); ?> 308 <?php endif; ?> 309 310 <?php echo $details . $compat . $upgrade_notice; ?> 311 </p> 312 </td> 313 </tr> 314 <?php 278 315 } 279 316 ?> 280 317 </tbody> 281 318 </table> 282 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> 283 </form> 284 <?php 319 320 <?php if ( current_user_can( 'update_plugins' ) ) : ?> 321 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> 322 </form> 323 <?php endif; 285 324 } 286 325 287 326 function list_theme_updates() { … … 296 335 297 336 ?> 298 337 <h3><?php _e( 'Themes' ); ?></h3> 299 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> 300 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'http://codex.wordpress.org/Child_Themes' ) ); ?></p> 301 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> 302 <?php wp_nonce_field('upgrade-core'); ?> 303 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 338 <p> 339 <?php _e( 'The following themes have new versions available.' ); ?> 340 <?php if ( current_user_can( 'update_themes' ) ) : ?> 341 <?php _e( 'Check the ones you want to update and then click “Update Themes”.' ); ?> 342 <?php endif; ?> 343 </p> 344 345 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost during an update. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'http://codex.wordpress.org/Child_Themes' ) ); ?></p> 346 347 <?php if ( current_user_can( 'update_themes' ) ) : ?> 348 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> 349 <?php wp_nonce_field('upgrade-core'); ?> 350 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 351 <?php endif; ?> 352 304 353 <table class="widefat" id="update-themes-table"> 305 <thead> 306 <tr> 307 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th> 308 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th> 309 </tr> 310 </thead> 354 <?php if ( current_user_can( 'update_themes' ) ) : ?> 355 <thead> 356 <tr> 357 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th> 358 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th> 359 </tr> 360 </thead> 361 362 <tfoot> 363 <tr> 364 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th> 365 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th> 366 </tr> 367 </tfoot> 368 <?php endif; ?> 311 369 312 <tfoot>313 <tr>314 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>315 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>316 </tr>317 </tfoot>318 370 <tbody class="plugins"> 319 371 <?php 320 372 foreach ( $themes as $stylesheet => $theme ) { 321 echo " 322 <tr> 323 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th> 324 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td> 325 </tr>"; 373 ?> 374 375 <tr> 376 <th scope="row" class="check-column"><input type="checkbox" name="checked[]" value="<?php esc_attr_e( $stylesheet ); ?>" /></th> 377 <td class="plugin-title"> 378 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" style="float: left; padding: 0 5px 5px;" /> 379 <strong><?php echo $theme->display('Name'); ?></strong> 380 <?php printf( __( 'You have version %s installed.' ), $theme->display('Version') ); ?> 381 382 <?php if ( current_user_can( 'update_themes' ) ) : ?> 383 <?php printf( __( 'Update to %s.' ), $theme->update['new_version'] ); ?> 384 <?php else : ?> 385 <?php printf( __( '%s is available.' ), $theme->update['new_version'] ); ?> 386 <?php endif; ?> 387 </td> 388 </tr> 389 390 <?php 326 391 } 327 392 ?> 328 393 </tbody> 329 394 </table> 330 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 331 </form> 332 <?php 395 396 <?php if ( current_user_can( 'update_themes' ) ) : ?> 397 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 398 </form> 399 <?php endif; 333 400 } 334 401 335 402 function list_translation_updates() { … … 515 582 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; 516 583 echo '</p>'; 517 584 518 if ( $core = current_user_can( ' update_core' ) )585 if ( $core = current_user_can( 'view_core_updates' ) ) 519 586 core_upgrade_preamble(); 520 if ( $plugins = current_user_can( ' update_plugins' ) )587 if ( $plugins = current_user_can( 'view_plugin_updates' ) ) 521 588 list_plugin_updates(); 522 if ( $themes = current_user_can( ' update_themes' ) )589 if ( $themes = current_user_can( 'view_theme_updates' ) ) 523 590 list_theme_updates(); 524 591 if ( $core || $plugins || $themes ) 525 592 list_translation_updates(); … … 535 602 536 603 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { 537 604 538 if ( ! current_user_can( ' update_core' ) )539 wp_die( __( 'You do not have sufficient permissions to updatethis site.' ) );605 if ( ! current_user_can( 'view_core_updates' ) ) 606 wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) ); 540 607 541 608 check_admin_referer('upgrade-core'); 542 609 … … 559 626 560 627 } elseif ( 'do-plugin-upgrade' == $action ) { 561 628 562 if ( ! current_user_can( ' update_plugins' ) )563 wp_die( __( 'You do not have sufficient permissions to updatethis site.' ) );629 if ( ! current_user_can( 'view_plugin_updates' ) ) 630 wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) ); 564 631 565 632 check_admin_referer('upgrade-core'); 566 633 … … 587 654 588 655 } elseif ( 'do-theme-upgrade' == $action ) { 589 656 590 if ( ! current_user_can( ' update_themes' ) )591 wp_die( __( 'You do not have sufficient permissions to updatethis site.' ) );657 if ( ! current_user_can( 'view_theme_updates' ) ) 658 wp_die( __( 'You do not have sufficient permissions to view updates for this site.' ) ); 592 659 593 660 check_admin_referer('upgrade-core'); 594 661 -
src/wp-includes/capabilities.php
1282 1282 $caps[] = $cap; 1283 1283 } 1284 1284 break; 1285 case 'view_plugin_updates': 1286 case 'view_theme_updates': 1287 case 'view_core_updates': 1288 if ( is_multisite() && ! is_super_admin( $user_id ) ) 1289 $caps[] = 'do_not_allow'; 1290 else 1291 $caps[] = 'manage_options'; 1292 break; 1285 1293 case 'activate_plugins': 1286 1294 $caps[] = $cap; 1287 1295 if ( is_multisite() ) { -
src/wp-includes/update.php
520 520 function wp_get_update_data() { 521 521 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 ); 522 522 523 if ( $plugins = current_user_can( ' update_plugins' ) ) {523 if ( $plugins = current_user_can( 'view_plugin_updates' ) ) { 524 524 $update_plugins = get_site_transient( 'update_plugins' ); 525 525 if ( ! empty( $update_plugins->response ) ) 526 526 $counts['plugins'] = count( $update_plugins->response ); 527 527 } 528 528 529 if ( $themes = current_user_can( ' update_themes' ) ) {529 if ( $themes = current_user_can( 'view_theme_updates' ) ) { 530 530 $update_themes = get_site_transient( 'update_themes' ); 531 531 if ( ! empty( $update_themes->response ) ) 532 532 $counts['themes'] = count( $update_themes->response ); 533 533 } 534 534 535 if ( ( $core = current_user_can( ' update_core' ) ) && function_exists( 'get_core_updates' ) ) {535 if ( ( $core = current_user_can( 'view_core_updates' ) ) && function_exists( 'get_core_updates' ) ) { 536 536 $update_wordpress = get_core_updates( array('dismissed' => false) ); 537 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest') ) && current_user_can('update_core') )537 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ) ) && current_user_can( 'view_core_updates' ) ) 538 538 $counts['wordpress'] = 1; 539 539 } 540 540