Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIP Parse.ly: Check for Support User class exists in the vip-parsely plugin #6016

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading