I have an field role_type with values - 0,1,2...

And I need to add role X to all users who have role_type = 2?

How can I do that? Rules? SQL?

Thanks for your help.

1 Answer 1


I think you could write a little module.

  1. db_select() all users with that role_type entry
  2. user_load() them and user_save() them with updated $user->roles[]

Maybe this thread HOWTO assign a user to a role programatically on drupal.org can give you a deeper insight.

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.