Specifically, when an admin goes to the 'People' admin screen, selects some users, then goes to 'Remove a role from the selected users', I want to capture this and apply some other actions.

To give a little bit of insight into what I'm doing: I have another set of tables in the same database belonging to a CRM, and when the user is removed from xyz group, it should toggle the account status in the CRM as well. The action of toggling the status is no problem, I just need to know the best way of going about capturing the role removal. Is there a quick way of doing this, or am I going to need to create a new cancellation method via hook_user_cancel_methods_alter()?

1 Answer 1


You can use Rules module for it. There is an event "After updating an existing user account", add conditions "User has roles" (both for account-unchanged and account parameters to check roles before and after an update), and as a action you can use "Run custom PHP code" to do whatever you want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.