Allow the 'WordPress Updates' page to be accessible even if you cannot update core, as long as you can update plugins or themes. fixes #21124.
git-svn-id: https://develop.svn.wordpress.org/trunk@21199 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4a23ebe03d
commit
493a3874dd
@ -34,7 +34,14 @@ if ( ! is_multisite() || is_super_admin() )
|
|||||||
$update_data = wp_get_update_data();
|
$update_data = wp_get_update_data();
|
||||||
|
|
||||||
if ( ! is_multisite() ) {
|
if ( ! is_multisite() ) {
|
||||||
$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>" ), 'update_core', 'update-core.php');
|
if ( current_user_can( 'update_core' ) )
|
||||||
|
$cap = 'update_core';
|
||||||
|
elseif ( current_user_can( 'update_plugins' ) )
|
||||||
|
$cap = 'update_plugins';
|
||||||
|
else
|
||||||
|
$cap = 'update_themes';
|
||||||
|
$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');
|
||||||
|
unset( $cap );
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
|
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
|
||||||
|
@ -18,7 +18,7 @@ if ( is_multisite() && ! is_network_admin() ) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_core' ) )
|
if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
|
||||||
wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
|
wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
|
||||||
|
|
||||||
function list_core_update( $update ) {
|
function list_core_update( $update ) {
|
||||||
@ -134,11 +134,7 @@ function core_upgrade_preamble() {
|
|||||||
global $upgrade_error, $wp_version;
|
global $upgrade_error, $wp_version;
|
||||||
|
|
||||||
$updates = get_core_updates();
|
$updates = get_core_updates();
|
||||||
?>
|
|
||||||
<div class="wrap">
|
|
||||||
<?php screen_icon('tools'); ?>
|
|
||||||
<h2><?php _e('WordPress Updates'); ?></h2>
|
|
||||||
<?php
|
|
||||||
if ( $upgrade_error ) {
|
if ( $upgrade_error ) {
|
||||||
echo '<div class="error"><p>';
|
echo '<div class="error"><p>';
|
||||||
if ( $upgrade_error == 'themes' )
|
if ( $upgrade_error == 'themes' )
|
||||||
@ -183,13 +179,6 @@ function core_upgrade_preamble() {
|
|||||||
echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
|
echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
|
||||||
}
|
}
|
||||||
dismissed_updates();
|
dismissed_updates();
|
||||||
|
|
||||||
if ( current_user_can( 'update_plugins' ) )
|
|
||||||
list_plugin_updates();
|
|
||||||
if ( current_user_can( 'update_themes' ) )
|
|
||||||
list_theme_updates();
|
|
||||||
do_action('core_upgrade_preamble');
|
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_plugin_updates() {
|
function list_plugin_updates() {
|
||||||
@ -454,10 +443,26 @@ if ( 'upgrade-core' == $action ) {
|
|||||||
|
|
||||||
wp_version_check();
|
wp_version_check();
|
||||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||||
core_upgrade_preamble();
|
?>
|
||||||
|
<div class="wrap">
|
||||||
|
<?php screen_icon('tools'); ?>
|
||||||
|
<h2><?php _e('WordPress Updates'); ?></h2>
|
||||||
|
<?php
|
||||||
|
if ( current_user_can( 'update_core' ) )
|
||||||
|
core_upgrade_preamble();
|
||||||
|
if ( current_user_can( 'update_plugins' ) )
|
||||||
|
list_plugin_updates();
|
||||||
|
if ( current_user_can( 'update_themes' ) )
|
||||||
|
list_theme_updates();
|
||||||
|
do_action('core_upgrade_preamble');
|
||||||
|
echo '</div>';
|
||||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||||
|
|
||||||
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
|
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'update_core' ) )
|
||||||
|
wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
|
||||||
|
|
||||||
check_admin_referer('upgrade-core');
|
check_admin_referer('upgrade-core');
|
||||||
|
|
||||||
// do the (un)dismiss actions before headers,
|
// do the (un)dismiss actions before headers,
|
||||||
|
Loading…
Reference in New Issue
Block a user