From ee50c7980eff47498e9837ba952bc91f85a37938 Mon Sep 17 00:00:00 2001 From: Henrique Mouta Date: Tue, 26 Nov 2024 09:25:57 +0000 Subject: [PATCH 1/2] Add WP_INSTALLING guard to the vip-parsely plugin --- vip-parsely/vip-parsely.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vip-parsely/vip-parsely.php b/vip-parsely/vip-parsely.php index de6ae4dd91..0718c18a57 100644 --- a/vip-parsely/vip-parsely.php +++ b/vip-parsely/vip-parsely.php @@ -1,5 +1,4 @@ Date: Fri, 29 Nov 2024 12:24:50 +0000 Subject: [PATCH 2/2] Check if the Support User class exists instead of relying on `WP_INSTALLING` const --- vip-parsely/vip-parsely.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vip-parsely/vip-parsely.php b/vip-parsely/vip-parsely.php index 0718c18a57..ec24831d8c 100644 --- a/vip-parsely/vip-parsely.php +++ b/vip-parsely/vip-parsely.php @@ -17,11 +17,6 @@ use Automattic\VIP\Parsely\Telemetry\Tracks; use Automattic\VIP\Support_User\User as Support_User; -// Prevent loading this file if it's being loaded during the WordPress installation process. -if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) { - return; -} - /** * This is determined by our value passed to the `WP_Widget` constructor. * @@ -92,6 +87,13 @@ function (): void { * @return bool Whether the current user can use the Parse.ly Content Helper feature. */ add_filter( 'wp_parsely_current_user_can_use_pch_feature', function ( $current_user_can_use_pch_feature, $feature_name, $current_user ) { + // If the VIP Support User plugin is not active, return the original value. + // This prevents a fatal error when the plugin is not active, under certain conditions. + // See https://github.com/Automattic/vip-go-mu-plugins/pull/6016 + if ( ! class_exists( 'Automattic\\VIP\\Support_User\\User' ) ) { + return $current_user_can_use_pch_feature; + } + $user_id = $current_user->ID; if ( Support_User::user_has_vip_support_role( $user_id ) ) {