Hi - if by 'on the registration page' you mean on the page where they create an account, then Moodle doesn't work like that because roles are not assigned to the system but to invidual courses (See Assign roles) If you mean on the course enrolment page then I'm still not sure how that would work because if someone is presented with the option of student or teacher without an enrolment key, then they could still select the wrong one and be given the wrong role. However, I am not a programmer so don't know anything a bout custom development -hopefully someone else will. (I changed the subject title to clarify)
Enrolment
Self enroll as student and as teacher
This discussion has been locked so you can no longer reply to it.