diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index d9db2e600a..c7b5905f43 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -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() ); diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index fe22d87a06..c453fc0841 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -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() ),