Skip to content

Commit

Permalink
VIP Parse.ly: Check for Support User class exists in the vip-parsely …
Browse files Browse the repository at this point in the history
…plugin (#6016)

* Add WP_INSTALLING guard to the vip-parsely plugin

* Check if the Support User class exists instead of relying on `WP_INSTALLING` const

---------

Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
  • Loading branch information
vaurdan and acicovic authored Dec 4, 2024
1 parent 00c35f2 commit 97c10f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vip-parsely/vip-parsely.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Plugin Name: VIP Parse.ly Integration
* Plugin URI: https://parse.ly
Expand Down Expand Up @@ -88,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 ) ) {
Expand Down

0 comments on commit 97c10f8

Please sign in to comment.