Support » Plugin: Authorizer » Problem with role

  • Resolved jsafont

    (@jsafont)


    Hi! We are using this plugin in our new project. Next i’ll explain the problem we have:

    We have WordPress + WooCommerce + Authorizer. When an user creates a new account in our portal, automatically receives a Subscriptor role. When the user buys a membership, it receives the customer role, BUT if the user click on the logout button and enter to the portal after, the Authorizer plugin gives to the user the Subscriptor role again.

    We’ve checked the selector that is in the settings for the default role, but changing the role to another not seems to make effect…

    Any suggestion please?

    Kind regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author pkarjala

    (@pkarjala)

    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

    Plugin Author Paul Ryan

    (@figureone)

    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?

    Plugin Author pkarjala

    (@pkarjala)

    Please try updating to the latest Authorizer version, 2.7.0, to see if this resolves the listed issues.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with role’ is closed to new replies.