Selected users for external database enrollment

Selected users for external database enrollment

per Bernie Rey Barsomo -
Nombre de respostes: 5
Hi! I just want to ask if its possible to only enroll into moodle those users who possess specific criteria? For example:

Users
NAME AGE GENDER
Dan 21 Male
Jona 23 Female
 Sam  18 Female 

The criteria is gender and I am only to enroll users that are female. How do I do that?

Big thanks!





Mitjana de qualificacions: -
En resposta a Bernie Rey Barsomo

Re: Selected users for external database enrollment

per Emma Richardson -
Imatge Documentation writers Imatge Particularly helpful Moodlers Imatge Plugin developers

When you say enroll - do you mean into a course?  

https://moodle.org/plugins/enrol_attributes

En resposta a Emma Richardson

Re: Selected users for external database enrollment

per Bernie Rey Barsomo -
Hi Emma! Thanks for your response. Sorry for the confusion. I meant External Database Authentication smile
En resposta a Bernie Rey Barsomo

Re: Selected users for external database enrollment

per Leon Stringer -
Imatge Core developers Imatge Particularly helpful Moodlers

So to be clear: authentication is providing access to the site using an external source, enrolment is adding users into courses using an external source.

If you only want a subset of the users table to be able to access the site you'll need to create a database view in that only returns the subset and specify that view in the Table field in the External Database authentication plugin settings.

For example if the external database was MySQL the view could be created with:

CREATE VIEW users_female AS SELECT name, ... FROM users WHERE gender = 'Female';
En resposta a Leon Stringer

Re: Selected users for external database enrollment

per Mathew Gancarz -
Imatge Core developers
Seconding this recommendation, this has worked very well for us for years. Just be careful with tweaking the view parameters since it will unenroll students that are removed from the view.