At the moment I'm working on a small Drupal-project. Everything is running fine - writing modules for Drupal seems to be very interesting. I've come to a point where I need some advice/help.
In the end, my Drupal webapplication will be used by 2 groups of people. Roles have been made for these groups:
- Patients
- Doctors
What each group can and can't do within the application doesn't matter now, it's about the registration proces:
- Patients: these have to be added to the application by the administrator. As far as I know nothing has to be changed - this is a standard functionality in Drupal. Perfect.
- Doctors: these persons can register themself but need to have a special code (unique for each doctor) in order to successfully complete the registration proces. These codes are stored in a table. So, if a doctor doesn't have such a code, he won't be able to use the webapplication.
Pure PHP/MySQL-wise, this is easy, but I can't figure out on how to accomplish this in Drupal. Probably the registration-proces has to be edited in some way, but how? Are there any special modules for such a functionality available? Hints? Tips? Any links?
Extra question: is it also possible to provide special information fields for each role? For example: when registering, a doctor can fill in a 'organisation'-field to indicate which organisation he's a member to. For a patient, this information is irrelevant.
Thanks in advance! :)
Comments
You could add code in your
You could add code in your module that implements the form_alter() hook and then changes the user_register form:
http://api.drupal.org/api/function/user_register/5
http://api.drupal.org/api/function/hook_form_alter/5
That's the 'proper' way to do it.
There may be an easier way though... you could try the Login Toboggan or Workflow-ng modules, and you could maybe do some redirect and permission tricks so that you 'get around' the issue...
It would maybe involve allowing people to register but then they get redirected to a page which you set up to take a code. Only once they enter the code, do they get promoted to "doctor" status... until then, they will have an account but no access to anything (because they will not have the required role). One or the other of those two modules will do it.
Hope that helps
Mark
http://codebaboon.com
Drupal based services
Thank you
Thank you for the help. I have found a solution for my problem, although it's not the one you suggested (although that should have worked as well).
I have found a Registration Code module which is right what I need except of the fact that it doesn't look for possible registration codes in a table (these can be manually entered in a textfield). I have edited some of the code and now it works just like I wanted.
Thanks again :)
Raf
I've added Registration Code functionality to OGR
I've recently added Registration Code functionality to OG User Roles: http://drupal.org/node/217229.
I wanted the flexibility to add lists of codes to groups, optionally use them on a per-group basis, make them unique, allow them to be deleted upon use, and allow admins to assign default (group) roles to users who subscribe using them.
I'm interested to see how this works outside of my application. It isn't part of the official release yet, so if anyone wants to try this out, you can post a request in the OG User Roles issue forum and I'll provide a patch.
Thanks.
link users
I need to link users in almost the same context as RaFP007's patients / doctors so that a patient has a doctor field in their profile.
It would allow a doctor to post to a patient by a user reference cck field and a user to be presented a view with his posts and the doctor's post targeted to this patient.
I cannot find the way to populate a user list (roles doctor) in a selection profile list, but there might be some other way to achives this.
thanx in advance for your help
Not sure I follow, but can
Not sure I follow, but can you start a new thread since it's actually off topic. Will answer in there.
Thanks
Mark
http://codebaboon.com
Drupal based services
thread created
Thank you very much for your fast answer, the thread is here :
http://drupal.org/node/215083
subscribing
adding