Customize: Prevent showing SFTP theme installation notification in multisite when user cannot install themes.

Props flixos90.
See #37661, #42184.
Fixes #42674 for 4.9 branch.

Built from https://develop.svn.wordpress.org/branches/4.9@42537


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2018-01-22 06:16:41 +00:00
parent 2441c3c3f1
commit 3ed6b9efd4
4 changed files with 11 additions and 10 deletions

View File

@ -2564,7 +2564,7 @@
// Temporary special function since supplying SFTP credentials does not work yet. See #42184.
function disableInstallButtons() {
return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded;
return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
}
section.overlay.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
@ -3074,7 +3074,7 @@
api.Panel.prototype.attachEvents.apply( panel );
// Temporary since supplying SFTP credentials does not work yet. See #42184
if ( api.settings.theme._filesystemCredentialsNeeded ) {
if ( api.settings.theme._canInstall && api.settings.theme._filesystemCredentialsNeeded ) {
panel.notifications.add( new api.Notification( 'theme_install_unavailable', {
message: api.l10n.themeInstallUnavailable,
type: 'info',
@ -5132,7 +5132,7 @@
// Temporary special function since supplying SFTP credentials does not work yet. See #42184.
function disableInstallButtons() {
return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded;
return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
}
function updateButtons() {
control.container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );

File diff suppressed because one or more lines are too long

View File

@ -4636,8 +4636,9 @@ final class WP_Customize_Manager {
'previewFrameSensitivity' => 2000,
),
'theme' => array(
'stylesheet' => $this->get_stylesheet(),
'active' => $this->is_theme_active(),
'stylesheet' => $this->get_stylesheet(),
'active' => $this->is_theme_active(),
'_canInstall' => current_user_can( 'install_themes' ),
),
'url' => array(
'preview' => esc_url_raw( $this->get_preview_url() ),

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.3-alpha-42535';
$wp_version = '4.9.3-alpha-42537';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.