For whatever reason when I remove a role from a user's profile, at url site/user/user-id/edit it just comes back a few days later. I tried to check users_role table but I do not have that table.

enter image description here.

We do import every employee every night, based off Active Directory, but I do not touch their roles in the import.

I imagine the best way of solving this is finding the table that has every user's roles, then just removing that entry from the particular user.

1 Answer 1


Try to run this: show tables like '%role%'; MySQL statement. In the results returned you should see a users_roles table (not users_role). To that table's columns are stored the uid and rid, therefore you will be able to find all users that have assigned with a role or more, and possibly an answer to your question.

I would kindly suggest you, since those roles are appeared again and again, to search any by chance or forgotten user_save implementation within your code.

Hope this help!

  • Some reason I see users_roles as you suggested through cli, but not phpmyadmin - on the left sidebar... I also just found out phpmyadmin does show the users_roles, if you click on the database and not view it on the left sidebar. The role saves as not being apart of the user's roles, but after a week or two it reappears. Either way, your answer will solve my issue. My thinking is, I can alter it on the table level. Thank you!
    – Daedalus
    Commented Mar 16, 2016 at 13:00
  • hmm. When I remove the role from a user's profile, in Drupal's user's profile page, I see the entry from users_roles get removed (as we would expect)... but it comes back like a week later... Now I am curious if me removing the entry directly will actually stop this.
    – Daedalus
    Commented Mar 16, 2016 at 13:13
  • "We do import every employee every night" I insist to check for any user_save upon the import. Hopefully by removing manually from the db the roles entries will work. Let us know.
    – mchar
    Commented Mar 16, 2016 at 17:03
  • Good thinking. I checked the module that is used for the cron import, but the module does not use user_save anywhere in it. Which I suspected, because this issue does not happen every night, during the import. I did remove a user's role earlier today, on the db level, and that user now has the role again... before the end of the day... Maybe it's when they log in. I'll do some more digging.
    – Daedalus
    Commented Mar 16, 2016 at 19:46
  • Removed the role from the user, then had them revisit the site, but they did not regain the role. I will check tomorrow and see if it comes back after the midnight cron job.
    – Daedalus
    Commented Mar 16, 2016 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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