Commit e8c37e7 1 parent b33a8ac commit e8c37e7 Copy full SHA for e8c37e7
File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,19 @@ public function get_allowed_features( int $user_id ): array {
158
158
159
159
// Check if user has access to the feature by role.
160
160
$ allowed_roles = $ settings ['roles ' ] ?? [];
161
- if (
162
- $ role_based_access_enabled &&
163
- ! empty ( $ allowed_roles ) &&
164
- ! empty ( array_intersect ( $ user_roles , $ allowed_roles ) )
165
- ) {
166
- $ allowed_features [ $ feature_class ::ID ] = $ feature_class ->get_label ();
167
- continue ;
161
+ if ( $ role_based_access_enabled ) {
162
+ // For super admins that don't have a specific role on a site, treat them as admins.
163
+ if ( is_multisite () && is_super_admin ( $ user_id ) && empty ( $ user_roles ) ) {
164
+ $ user_roles = [ 'administrator ' ];
165
+ }
166
+
167
+ if (
168
+ ! empty ( $ allowed_roles ) &&
169
+ ! empty ( array_intersect ( $ user_roles , $ allowed_roles ) )
170
+ ) {
171
+ $ allowed_features [ $ feature_class ::ID ] = $ feature_class ->get_label ();
172
+ continue ;
173
+ }
168
174
}
169
175
170
176
// Check if user has access to the feature.
You can’t perform that action at this time.
0 commit comments