Differentiating allowed email domains with same @domain.com but different prefix

Differentiating allowed email domains with same @domain.com but different prefix

by Dirk Meyer -
Number of replies: 2

For allowing account creation based on email domain, if using '@domain.com' for staff and students but the info in front of the '@' is different - staff is firstname.lastname  students are a combo of numbers and letters.

Is there way to differentiate these accounts in Moodle at account creation time and when logging in? We want this because we want all users to be in a custom role at first time of login to Moodle.

Thank you kindly for any advice.  

Average of ratings: -
In reply to Dirk Meyer

Re: Differentiating allowed email domains with same @domain.com but different prefix

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I'm not aware of a way this could be done directly.

Presumably "custom role" is a course enrolment role? If not please explain further.

A circuitous workaround could be to have a custom user profile field in Moodle with the email domain only and using Enrol by user profile fields to enrol the user as a student or staff member based on this. That would depend on your being able to provide the email domain as separate field when populating the users in Moodle.

In reply to Leon Stringer

Re: Differentiating allowed email domains with same @domain.com but different prefix

by Dirk Meyer -
Thank you for having taken the time to respond.

The site is a course sharing site and we want only confirmed educators to have access to answer keys, questions banks, quizzes etc. The custom role would be applied to users having a pre-approved email format. The process should be automated so when educators with an email address that follows a previously pre-approved email domain come to the site for the first time, a custom role is applied to those accounts giving them access to keys, exams etc. on all courses of the site. Moodle's allowed and denied email domain feature comes close but does not allow for filtering based on what is in front of the @ sign.