Refreshing enrolment data without logging in?

Refreshing enrolment data without logging in?

by Ben Steeples -
Number of replies: 2
Hi all,

We currently use a mix of Internal and ExternalDB enrolment for our users. ExternalDB enrolment is run on a nightly basis via the enrol_database_sync.php script.

As we understand it, the enrolments aren't actually made live in Moodle until the user next logs in. However this is unsuitable for us, as our teachers want to group students before the start of term, and hence before the students log in and are assigned to courses.

Is there any way of forcing an enrolment refresh for any given user? We've tried digging around in the login and enrolment scripts for an answer, but it's all a bit bewildering.

Many thanks,
Ben
Average of ratings: -
In reply to Ben Steeples

Re: Refreshing enrolment data without logging in?

by Alan Zaitchik -
Ben,
Excuse my jumping onto your thread, but I am having trouble even launching the enrol_database_sync.php script. I tried running it in a "DOS" window but the script cannot locate the setup.php file (from inside config.php). I would also like to invoke it from within the usual cron job but I am not sure how to do this either. Should I simply add a "require" statement to one of the lib.php files that currently executes? I suppose I would have to edit out the lines that detect executing inside Apache and die.
In short: how the heck does one run this script? Can I simply POST a request to the server to execute the script?
I know this is not the subject of your thread but you seem to be able to run the script, and I hope you will not mind answering my simpler questions!
Alan
In reply to Ben Steeples

Re: Refreshing enrolment data without logging in?

by Stephen Martin -
Enrolments are "live" either when you run the enrol_database_sync.php script *or* when the user logs in (whichever comes *first*). So, after you run the nightly enrol_database_sync.php cron job, you should be able to group students without them ever having logged in.

This is what I'm doing on my Moodle install (1.9.1).