- The docs say "External database enrolment happens at the moment when a user logs into Moodle.", what does that mean? What exactly happens when a user logs in?
As Helen says, when the user logs in, there is a call to setup_enrolments(), which is called from require_login() through a series of intermediate functions. This is where the enrolment takes place. So if a user never logs in, s/he is never enrolled into any course (by the external database enrolment plugin).
- Then it says "An easy way of checking how it's working is to try logging in as a student.". Ok, that's nice, but what am I expecting to see? I do get a few irritating notices about skipping courses at the top of the screen but that looks like a bug.
I'd say this is a bug too.
IMHO they should go to the system logs, instead of being print on screen. If you have everything correctly setup, the user should log in normally and see the list of courses s/he is enrolled into, just as you'd be using manual enrolment. At least that's what we get in our setup.
- Next sentence - "External database enrolment also manages unenrolment. ". This worries me! What exactly does this mean? Does this mean that a student who is not in the database (any more) will be removed from the course? If so, is there any way to stop this? I am thinking about completed courses that I want to keep available in an "archive".
It means that if a given user is no longer in the external enrolment database, as far as Moodle concerns, this user is no longer enrolled into any courses. The external database is the master for the enrolment data, so Moodle just 'synchronizes' to that data. If you don't want your users to be unenrolled, you need to remove the part of the code that unenrols people, or mark those enrolmentes that you want to 'archive' as 'manual' enrolments (so the external database enrolment plugins doesn't touch them).
- Next para. "You may synchronize all enrolments by executing the enrol_database_sync.php script". Ok, what does that do?
That performs the enrolment/unenrolment logic without the users needing to log in. So you 'synchronize' all[1] of your enrolments at once.
[1] All the enrolments marked as 'database', that is.
- ..and "This assumes that you have already synchronized all users from your authorization plugin.". Errr..... never mind
This is quite understandable. If you are going to enrol someone into a course, you need that someone to exist in Moodle beforehand. As users are created the first time they log in, unless you synchronize your users (to create/delete all of them without having to log in), there'll be no users to enrol. A bit convoluted, but completely logical
- Elsewhere in the forum, automatic course generation gets mentioned, but I don't see any reference to this. How does this work - if it indeed exists?
It exists (we are using it too
). If you enable course creation, whenever the plugin tries to enrol someone into a course, it checks whether the course exists or not. If it doesn't, it pulls some data from your external enrolment database and creates the course on the fly, and then enrols that someone into the course.
You can configure a couple of things or two (like the course template for course auto-creation and the category where you are going to put your course), but that's it in standard Moodle. We have a little patch that adds some additional settings like being able to specify a differente category and template for each course (available for 1.5 through 1.9dev). Should you be interested in it, you can get it from:
http://orodruin.escomposlinux.org/~iarenaza/moodle/(there is no 1.9 directory there because there is no 1.9 version yet, but the patch for 1.8 applies cleanly to 1.9dev as of today).
Hope this helps
Saludos. Iñaki.