Issue with Ultimate membership plugin
-
Hey, I noticed that the plugin has a compatibility issue with user roles when using the Ultimate Membership plugin. The main reason is
$user->roles
return array without 0 index. And in code, you very often retrieve a role like this$user->roles[0]
eg:includes/classes/Authenticator/Login.php:549
if ( 'backup_codes' !== $provider && SettingsPage::are_backup_codes_enabled( $user->roles[0] ) && isset( $codes_remaining ) && $codes_remaining > 0 ) {
includes/classes/Admin/Controllers/class-settings.php:177
if ( null === $role ) { $role = $user->roles[0]; }
I temporarily fixed the problem at my site by replacing
$user->roles[0]
intoarray_pop($user->roles)
but that doesn’t solve the problem globally. I think you should add an util that will get the role regardless of indexes
- The topic ‘Issue with Ultimate membership plugin’ is closed to new replies.