Hi @jsafont,
Authorizer maintains a separate role list from the WordPress role assignments. Because of this, when roles are updated by a different plugin (such as WooCommerce), it does not update the information in Authorizer. As such, when the user logs back in again, Authorizer sets the role according to the information in its own role table, not the currently set WordPress role.
Looking at our current functionality, we don’t catch all role changes done in WordPress right now. We do check for when WordPress itself makes user role changes, but we donʻt check when a role is changed by an external entity such as another plugin.
After talking with our lead dev, weʻll start work on a different hook that checks against all role changes in WordPress, regardless if they were initiated by WordPress, Authorizer, or a separate plugin, so long as they go through the proper WordPress hooks to update a userʻs profile. This should then update Authorizer accordingly. Iʻll follow up once this patch is live.
Hi,
I’m facing the same sort of problem but without external plugin.
> I set Authorizer default role preference to “subscriber”.
> I create a new user
> I edit this user in the native WP user edit screen and grant him with the “editor” role
> I log the user with Authorizer
> He’s back as subscriber
What can I do to force the role to stay as is was?
Thanks
There is already code in the plugin that should handle this situation, so this shouldn’t be happening:
* When a new user is created in WordPress, they are added to the Authorizer Approved list with the role you gave them on creation.
https://github.com/uhm-coe/authorizer/blob/master/authorizer.php#L5522-L5572
* When a user is edited in the native WordPress user edit screen, their role in the Authorizer Approved list is updated to match.
https://github.com/uhm-coe/authorizer/blob/master/authorizer.php#L3146-L3183
Could you provide some more details about your setup and process to see if there’s some edge case?
* What WordPress version?
* Multisite or single?
* What version of the plugin?
* Any other plugins installed?
* Any custom theme code that deals with roles?
* Do users get assigned multiple roles?
Please try updating to the latest Authorizer version, 2.7.0, to see if this resolves the listed issues.