diff --git a/includes/Classifai/Admin/UserProfile.php b/includes/Classifai/Admin/UserProfile.php index 4982f2862..7131fc1ac 100644 --- a/includes/Classifai/Admin/UserProfile.php +++ b/includes/Classifai/Admin/UserProfile.php @@ -158,13 +158,19 @@ public function get_allowed_features( int $user_id ): array { // Check if user has access to the feature by role. $allowed_roles = $settings['roles'] ?? []; - if ( - $role_based_access_enabled && - ! empty( $allowed_roles ) && - ! empty( array_intersect( $user_roles, $allowed_roles ) ) - ) { - $allowed_features[ $feature_class::ID ] = $feature_class->get_label(); - continue; + if ( $role_based_access_enabled ) { + // For super admins that don't have a specific role on a site, treat them as admins. + if ( is_multisite() && is_super_admin( $user_id ) && empty( $user_roles ) ) { + $user_roles = [ 'administrator' ]; + } + + if ( + ! empty( $allowed_roles ) && + ! empty( array_intersect( $user_roles, $allowed_roles ) ) + ) { + $allowed_features[ $feature_class::ID ] = $feature_class->get_label(); + continue; + } } // Check if user has access to the feature.