PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | includes/classes/Screen/Settings.php +20 -7 5.0.05.3.5 View file →
@@ -96,14 +96,16 @@
96 96 $host = esc_url_raw( trim( $post['ep_host'] ) );
97 97 Utils\update_option( 'ep_host', $host );
98 98 }
99 99
100 - if ( isset( $post['ep_credentials'] ) ) {
101 - $credentials = ( isset( $post['ep_credentials'] ) ) ? Utils\sanitize_credentials( $post['ep_credentials'] ) : [
102 - 'username' => '',
103 - 'token' => '',
104 - ];
100 + if ( isset( $post['ep_credentials'] ) && ( ! defined( 'EP_CREDENTIALS' ) || ! EP_CREDENTIALS ) ) {
101 + $credentials = Utils\sanitize_credentials( $post['ep_credentials'] );
105 102
103 + // Preserve the existing token if the field was left empty (it is always empty on load).
104 + if ( empty( $credentials['token'] ) ) {
105 + $credentials['token'] = $this->prev_ep_credentials['token'];
106 + }
107 +
106 108 Utils\update_option( 'ep_credentials', $credentials );
107 109 }
108 110
109 111 if ( isset( $post['ep_bulk_setting'] ) ) {
@@ -111,9 +113,13 @@
111 113 }
112 114
113 115 $es_info = \ElasticPress\Elasticsearch::factory()->get_elasticsearch_info( true );
114 116 if ( empty( $es_info['version'] ) ) {
115 - add_action( 'admin_notices', [ $this, 'add_validation_notice' ] );
117 + if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
118 + add_action( 'network_admin_notices', [ $this, 'add_validation_notice' ] );
119 + } else {
120 + add_action( 'admin_notices', [ $this, 'add_validation_notice' ] );
121 + }
116 122
117 123 unset( $_POST['ep_host'] ); // Needed to prevent going to the next installation step
118 124 $this->reset_settings();
119 125 }
@@ -126,9 +132,11 @@
126 132 $target = ( Utils\is_epio() ) ?
127 133 _x( 'ElasticPress.io account', 'Settings validation message', 'elasticpress' ) :
128 134 _x( 'Elasticsearch server', 'Settings validation message', 'elasticpress' );
129 135
130 - if ( empty( $this->prev_ep_host ) ) {
136 + $is_first_setup = empty( $this->prev_ep_host );
137 +
138 + if ( $is_first_setup ) {
131 139 // Setting it for the first time -- probably during the install process.
132 140 $message = sprintf(
133 141 /* translators: EP.io account or ES server. */
134 142 __( 'It was not possible to connect to your %s. Please check your settings and try again.', 'elasticpress' ),
@@ -145,8 +153,13 @@
145 153 <div class="notice notice-error">
146 154 <p>
147 155 <?php echo wp_kses( $message, 'ep-html' ); ?>
148 156 </p>
157 + <?php if ( Utils\is_epio() && ! $is_first_setup ) : ?>
158 + <p>
159 + <?php esc_html_e( 'If you are trying to deactivate your site\'s communication with ElasticPress.io, temporarily disable the ElasticPress plugin instead.', 'elasticpress' ); ?>
160 + </p>
161 + <?php endif; ?>
149 162 </div>
150 163 <?php
151 164 }
152 165