From 5dd84157b411ef4dead921b3ccf473eb48a674c8 Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Wed, 16 Oct 2024 14:15:00 -0600 Subject: [PATCH] Jetpack: Add shim for 13.9+ to prevent Jetpack_SSO fatal and admin notices for 13.5+ (#5937) * Jetpack: Add shim for 13.9+ to prevent Jetpack_SSO fatal and admin notice for 13.5+ * Need to extend the darn class to prevent undefined method fatals * use Capability Condition * Revert "use Capability Condition" This reverts commit f441783691eb72be5f284b9f44a179770dbe4df8. * remove condition since it is super admin by default if no cap condition specified --- admin-notice/admin-notice.php | 17 +++++++++++++++++ vip-jetpack/jetpack-sso-dummy.php | 7 +++++++ vip-jetpack/vip-jetpack.php | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 vip-jetpack/jetpack-sso-dummy.php diff --git a/admin-notice/admin-notice.php b/admin-notice/admin-notice.php index 3b84c5ade6..bf29887071 100644 --- a/admin-notice/admin-notice.php +++ b/admin-notice/admin-notice.php @@ -26,3 +26,20 @@ function () use ( $admin_notice_controller ) { do_action( 'vip_admin_notice_init', $admin_notice_controller ); } ); + +add_action( + 'vip_admin_notice_init', + function ( $admin_notice_controller ) { + $message = 'Heads up! Your site is using a deprecated plugin jetpack-force-2fa. This functionality is already included in Jetpack as of version 13.5. Please remove the plugin to avoid potential conflicts with future Jetpack updates.'; + $admin_notice_controller->add( + new Admin_Notice( + $message, + [ + new Expression_Condition( class_exists( 'Jetpack_Force_2FA' ) && class_exists( 'Jetpack' ) && defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '13.5', '>=' ) ), + ], + 'deprecated-standalone-jetpack-2fa-plugin', + 'error' + ) + ); + } +); diff --git a/vip-jetpack/jetpack-sso-dummy.php b/vip-jetpack/jetpack-sso-dummy.php new file mode 100644 index 0000000000..94c8114a66 --- /dev/null +++ b/vip-jetpack/jetpack-sso-dummy.php @@ -0,0 +1,7 @@ +=' ) ) { + require_once __DIR__ . '/jetpack-sso-dummy.php'; + } +} );