YESSSSSSSSSSSSSSSS!!!!! I GOT IT TO WORK!!!
After countless hours of debugging I found what is wrong. If you are like me: Windows 2003 / Moodle 2.1 / IIS 6 / PHP 5 / and MS SQL Server Driver for PHP 2, follow the steps below if you want it to work. I believe this is the final cure to the infamous problems involving "blank screen" or "nothing happens" after the user signs in.
First, I think there is a bug on the file: /lib/enrollib.php, so let's edit it.
See if there is a line with the following code (around line 1244):
public function sync_user_enrolments($user) {
override if necessary
}
Comment it out!
//public function sync_user_enrolments($user) {
// override if necessary
//}
Now scroll back up to around line 216. There is a code like this:
foreach($enabled as $enrol) {
$enrol->sync_user_enrolments($user);
}
Change it to:
foreach($enabled as $enrol) {
if(get_class($enrol)=="enrol_database_plugin"){
$enrol->sync_user_enrolments($user);
}
}
Almost done... now open file /enrol/database/lib.php
On line 72 there are definitions for the remote column names:
$coursefield = strtolower($this->get_config('remotecoursefield'));
$userfield = strtolower($this->get_config('remoteuserfield'));
$rolefield = strtolower($this->get_config('remoterolefield'));
Change those lines to:
$coursefield = $this->get_config('remotecoursefield');
$userfield = $this->get_config('remoteuserfield');
$rolefield = $this->get_config('remoterolefield');
This is an important step because many people tend to use both upper and lower case characters for column names. In my case, I named one of my columns as MoodleUserID. The code simply failed silently because it was looking for moodleuserid!
Now create a record in your remote table and sign in as the user being enrolled. It worked for me! I hope this can help others who are struggling with this too.