Changing default role when using email based enrollment

Changing default role when using email based enrollment

by Dirk Meyer -
Number of replies: 2
We would like every new account that is being created to be taken a different role than the generic 'authenticated user' role. We want to do that so that we can differentiate between students and staff easily.

Student accounts were bulk imported. New, email-based registration will only be by staff as we filter for domain based email registration. we will be adding more students in bulk.

Question: How can we set it up so that every new account using the email-based registration take on a custom role?

Why do we want to do this? We have many staff who are authenticated users but who are not teachers or are not in a course. We would like them to be able for example submit files in the database activity but we don't want students to have access to that database.


Average of ratings: -
In reply to Dirk Meyer

Re: Changing default role when using email based enrollment

by Randy Orwin -
Hi Dirk,

Given that roles are context specific, like at the site level, at a category level or a course level, in which context do you want to assign a different role? Thinking about the database activity, is it in a specific course or a front page activity.

One solution to differentiate staff could be to create a custom field in the profile and when users create an account via the email process they can update their account and add that new field. Now you can search users by that field.

As far as having it done automatically that might entail custom writing some code.

As far as the database is concerned you could assign roles at the activity level that would allow only those users assigned the appropriate role to work in the database.

To automate all of this, from my limited knowledge, would take some custom coding.

Good luck!
In reply to Randy Orwin

Re: Changing default role when using email based enrollment

by Dirk Meyer -
Hi Randy,

thank you for the reply!

In short, what we want to do is be able to assign a different role at account creation via email self-registration.

As I understand it, initially, Moodle makes every user an authenticated user. It is when users enrol into courses when one role differentiation works best, although I understand one can do that with Front Page activities too.


What I want to avoid is to manually search accounts and assign roles.

Thanks for the comments. I will do some more searching and thinking.