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

Props flixos90.
See #37661, #42184.
Fixes #42674.


git-svn-id: https://develop.svn.wordpress.org/trunk@42536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2018-01-22 06:14:10 +00:00
parent 8ae0bc51be
commit f65c46cc50
2 changed files with 6 additions and 5 deletions

View File

@ -2567,7 +2567,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() );
@ -3064,7 +3064,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',
@ -5092,7 +5092,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() );

View File

@ -4702,8 +4702,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() ),