Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By caveman on
I have figured out how to get a few extra questions to my users when they register, but no way to use that information to automatically assign a role. My goal is to have users register, and then make extra features automatically appear if they have answered certain questions a certain way (in this case a pull down menu) by automatically assigning them a role and then using features on the privacy_node_bypass module. If I could get help with this, it would help me a lot!
Thanks, Caveman
Comments
Opt-in module
http://drupal.org/node/14308 should do it. Not sure about 4.6 compatiblity though.
Don't want to use Cron
I'd rather have the information accessible instantly, and the documentation seems to suggest the opt-in module uses cron to process. Not sure it will work for this
After working on the actual implementation a bit, I think I may have asked the wrong question. Using roles would work if they are assigned instantly everytime a user enters/modifies my custom profile question, but it seems easier to access their profile questions directly using php. Will post that question on a separate thread. If anyone has an idea how to "instantly" auto-assign roles, I'll keep following this thread as well.
Thanks!
Caveman
PS. I'm using 4.5
Could make a module
Could make a module that maps profile_field values to roles at the time of edit.
It would only need to implement hook_user(), something like
Both the old and new value of the field are available and can be used on what action you want to take.
A more general solution that does not hardcode the profile field name would also want to have a page for setting up which field to act on and how to map it to roles.