PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-connection/src/class-error-handler.php +5 -42 16.3-a.5 → 16.3-a.1 View file →
@@ -277,9 +277,8 @@
277 277 * (e.g. 'none' to suppress the reconnect CTA); when absent, readers fall back
278 278 * to offering the reconnect CTA.
279 279 *
280 280 * @since 6.13.10
281 - * @since 9.8.0 Withholds a non-admin's reconnect CTA while a site connection error is on record.
282 281 *
283 282 * @return array Array of displayable errors with hierarchical structure.
284 283 * Example:
285 284 * [
@@ -324,9 +323,8 @@
324 323
325 324 // Viewer-wide, so resolved once rather than per error.
326 325 $viewer_can_connect = current_user_can( 'jetpack_connect' );
327 326 $viewer_can_connect_user = current_user_can( 'jetpack_connect_user' );
328 - $site_connection_broken = ! $viewer_can_connect && $this->has_site_connection_error( $verified_errors, $owner_id );
329 327
330 328 foreach ( $verified_errors as $error_code => $users ) {
331 329 // Only process error codes that are meant to be displayed to users.
332 330 // A raw verified error whose code is marked non-displayable in
@@ -430,13 +428,13 @@
430 428 : __( 'The connection owner needs to reconnect their WordPress.com account to restore the connection. If you reconnect instead, you will become the new connection owner and every other user will be disconnected from WordPress.com.', 'jetpack-connection' );
431 429 }
432 430 }
433 431
434 - // A non-admin relinks over the site connection, so while it is broken the
435 - // reconnect CTA cannot work for them. A reporter-declared action is left alone.
436 - if ( $viewer_owns_error && $site_connection_broken && empty( $error['error_data']['action'] ) ) {
437 - $message = __( 'Your WordPress.com account connection is broken, and the site connection needs attention too. Ask an administrator to restore the site connection, then reconnect your account.', 'jetpack-connection' );
438 - $action = 'none';
432 + // Relinking your own account and restoring the site are different actions
433 + // with different capabilities, and this notice only offers the second one.
434 + // A reporter-declared action is something else, so it is left alone.
435 + if ( $viewer_owns_error && ! $viewer_can_connect && empty( $error['error_data']['action'] ) ) {
436 + $action = 'none';
439 437 }
440 438
441 439 $error['audience'] = $audience;
442 440 $error['error_message'] = $message;
@@ -793,43 +791,8 @@
793 791 return 'owner';
794 792 }
795 793
796 794 return 'user';
797 - }
798 -
799 - /**
800 - * Whether a displayable site-audience error is on record that would stop a user relinking.
801 - *
802 - * Codes that survive owner promotion are inbound failures (WordPress.com cannot reach or
803 - * verify the site), which leave the outbound, blog-token-signed relink working.
804 - *
805 - * @since 9.8.0
806 - *
807 - * @param array $verified_errors The verified errors, keyed by error code then user ID.
808 - * @param int $owner_id The local user ID of the connection owner, or 0 if there is none.
809 - * @return bool
810 - */
811 - private function has_site_connection_error( $verified_errors, $owner_id ) {
812 - foreach ( $verified_errors as $error_code => $users ) {
813 - $display_config = $this->get_error_display_config( $error_code );
814 -
815 - if ( null === $display_config || ! empty( $display_config['survives_owner_promotion'] ) || ! is_array( $users ) ) {
816 - continue;
817 - }
818 -
819 - foreach ( array_keys( $users ) as $user_id ) {
820 - // Must precede classification, which would cast 'invalid' to 0 and read it as 'site'.
821 - if ( 'invalid' === $user_id ) {
822 - continue;
823 - }
824 -
825 - if ( 'site' === $this->classify_error_audience( $user_id, $owner_id ) ) {
826 - return true;
827 - }
828 - }
829 - }
830 -
831 - return false;
832 795 }
833 796
834 797 /**
835 798 * Whether an error describes the connection owner's own connection.