- Issue created by @bfetner
I have a custom module that creates a form on the main page. This module has nothing to do with modifying roles. When I submit this form from a user that is not admin and has a role active in the roleassign settings, that role and all the other roles that are active in roleassign are removed.
I've narrowed this down to the roleassign_form_alter function in the module file. On line 108 (2.0.3 version of the module) there is an if statement that checks if the form_id is equal to user_form. This statement contains a block that saves the current users roles to the sticky_role variable. This sticky_role variable is used to reorganize and preserve what roles that will later be added to the users account in the roleassign_user_presave function. Without this block the current roles are not included with the list of roles that overwrite the accounts roles.
My current fix is to include the id of my custom form to this if statement.
I'm curious as to why this section is limited to only the user_form if afterwards the function reorganizes the roles based on the sticky_role variable. And additional if a more general fix would be viable here.
Any insight would be appreciated.
Active
2.0
Code