Mixed Mode Enrollment

Mixed Mode Enrollment

by Robbie Newton -
Number of replies: 50

OK - here goes.

We have set up Moodle with LDAP authentication which works fine. We have also set up Moodle to automatically enroll students to courses using an external database. (BTW: Staff are not contained in the external database.)

In the configuarion of Moodle enrollment, we have also enabled manual enrollment.

The problems we have seem to be with staff (or anyone logged in who isn't included in the external database).

If a staff member logs in and enters a course they can manually enroll as expected. However, if they log out and back in they have to manaually enroll again. Anyone have suggestions on how to prevent this.

Also if we configure Moodle to not allow manual enrollment, but instead provide a key, then the same thing happens. Every login, they are asked to enroll.

I hope that explains our problem?!?

Average of ratings: -
In reply to Robbie Newton

Re: Mixed Mode Enrollment

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Robbie,

You're right - enrolment using an external database over-writes other methods of enrolment.

Please check Scott Krajewski's nice code in External database enrolment as cron job for only unenrolling users who were added from the external database. smile
In reply to Helen Foster

Re: Mixed Mode Enrollment

by Tim Allen -
You're right - enrolment using an external database over-writes other methods of enrolment.

Hmm...in that case, what is the use of the option with the checkbox "allow internal methods as well"? Are you sure this is not supposed to work, or is it a bug? thoughtful

I was wondering about this because I have also had similar problems in the past. My conclusion was that you can not mix enrolment between external and internal for one user, but that different users can have different methods of enrolment - but maybe that is not true...mixed

Any feedback on this is appreciated, smile

Tim.
In reply to Tim Allen

Re: Mixed Mode Enrollment

by Scott Krajewski -
I just submitted a bug. Here's some code that can fix it. Change the enrol_student call and then add an IF around the unenrol_student

enrol_student($user->id, $course->id, 0, 0, 'database');   /// Enrol the 
student



// only unenrol if the person was a database enrolee, auto won't remove a manual enrol
$selection = "userid = ".$user->id." and enrol = 'database'";
if(get_record_select(user_students,$selection)) {
unenrol_student($user->id, $courseid); /// Unenrol the student
unset($user->student[$course->id]); /// Remove from old list
}

In reply to Scott Krajewski

Re: Mixed Mode Enrollment

by Scott Krajewski -
Ooops, just realized something.
Need to specify the course!
$selection = "userid = ".$user->id." and course=".$courseid."and enrol = 'database'";


And the manual course enrolment needs to record it as such! In course/student.php change to

 if (! enrol_student($addstudent, $course->id, $timestart, $timeend, 'manual')) {


Otherwise the default behavior for enrol_student is to use the name of the current enrolment method,  database!

--S
In reply to Scott Krajewski

Re: Mixed Mode Enrollment

by Tim Allen -
Thanks a lot Scott!  approve  It's bug 3912.  I have voted for it, I hope others will too so that this bug can be patched in core ASAP. wink

Tim.
In reply to Scott Krajewski

Re: Mixed Mode Enrollment

by John Rodkey -
any chance of a diff for that code change?

We're experiencing the same thing.
moodle 1.5.2, linux LAMP system.
In reply to Helen Foster

Re: Mixed Mode Enrollment

by Chris Simpson -

The below function will replace the current function in enrol.php in the enrol\database folder.

This solution will not remove manually enrolled courses from the database enrolment method.

The function also includes an example how to manually map a course globally, useful for courses that are not held on your MIS system, i.e. A Generic Induction Course.

I am new to Moodle and php, but don't be surprised to see some more posts during the next few months.

We have this function working on Moodle 1.5.2 at Swansea College.


function get_student_courses(&$user) {
    global $CFG;

    parent::get_student_courses($user);

    if (strpos($CFG->prefix, $CFG->dbname) === false) {
        $oldprefix = $CFG->prefix;
        $CFG->prefix = "$CFG->dbname.$CFG->prefix";
    }

    // Try to connect to the external database

    $enroldb = &ADONewConnection($CFG->enrol_dbtype);

    if ($enroldb->PConnect($CFG->enrol_dbhost,$CFG->enrol_dbuser,$CFG->enrol_dbpass,$CFG->enrol_dbname)) {

        $courselist = array();      /// Initialise new array
        $newstudent = array();

        /// Get the authoritative list of enrolments from the database

        $useridnumber = $user->{$CFG->enrol_localuserfield};  

        if ($rs = $enroldb->Execute("SELECT $CFG->enrol_remotecoursefield
                                       FROM $CFG->enrol_dbtable
                                      WHERE $CFG->enrol_remoteuserfield = '$useridnumber' ")) {

            if ($rs->RecordCount() > 0) {
                while (!$rs->EOF) {
                    $courselist[] = $rs->fields[0];
                    $rs->MoveNext();
                }

                foreach ($courselist as $coursefield) {
                    if ($course = get_record('course', $CFG->enrol_localcoursefield, $coursefield)) {
                        $newstudent[$course->id] = true;             /// Add it to new list
                        if (isset($user->student[$course->id])) {   /// We have it already
                            unset($user->student[$course->id]);     /// Remove from old list
                        } else {
                            enrol_student($user->id, $course->id);   /// Enrol the student
                        }
                    }
                }
            }
      /////////////////////////////////////////////////////////////////////////////////////////////
      // Code snippet added in by C.Simpson 12th August 2005
      // Snippet refreshes current courses attached to students
      // This gets around the issue of manually enrolled courses being removed on logging in
      /////////////////////////////////////////////////////////////////////////////////////////////
      
      // Add your global manual enrolments here
      // newstudent[courseid] = true;
      // enrol_student($user->id,courseid);
      // *** Just alter the courseid for each entry
      // Code snippet added by C.Simpson 15th August 2005
      
      
      //Modified code to re-enrol students on courses
            if (!empty($user->student)) {    /// We have courses left that we do not want to unenrol from
                foreach ($user->student as $courseid => $value) {
         $newstudent[$courseid] = true;
         enrol_student($user->id,$courseid);
                }
            }
            $user->student = $newstudent;    /// Overwrite the array with the new one
        }
        $enroldb->Close();
    }

    if (!empty($oldprefix)) {
        $CFG->prefix = $oldprefix;           // Restore it just in case
    }
}

Average of ratings: Useful (1)
In reply to Chris Simpson

Re: Mixed Mode Enrollment

by Barron Koralesky -

I hadn't tried Chris's code before, so I did that on a different test machine.  (I had to revert to the older lib/moodlelib.php and enrol/enrol.class.php and make his edits to an older enrol.php)

His code seems to:
  1. preserve manually-enroled students
  2. not ask for the key or "do you want to enrol" when you click to a manually-enroled course
  3. add students from the database enrolment
However it does not seem to update for records dropped from the database.  That is, if you drop a record from the external database enrolment table, the student does not seem to be unenroled from the course.

Chris & Martin, does this help at all?


In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Marcus Schubert -
Hi,

i wanted to say, that this problem not only occurs when you add students manual but also with the metacourse feature.
You can look at this

Regards Marcus
In reply to Marcus Schubert

Re: Mixed Mode Enrollment

by Marcus Schubert -
By trying to make the metacourse enrollment work with database i found something that might solve your problem, that students are not gettin unenrolled if you delete the record from the database.

Look in your \enrol\database\enrol.php:

around line 72 you should find:
if (get_record_select('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database'))
change it into:
if (get_record_select('user_students', "userid = $user->id AND course = $courseid AND enrol = 'database'"))

This might do the magic for you and the students get unenrolled if you delete them from the database, but the metacourse enrollment still does not work.

Regards

Marcus
In reply to Marcus Schubert

Re: Mixed Mode Enrollment

by Marcus Schubert -
Hi, it's me again - seems i'm on a code rush breites Grinsen

I finally got the metacourse enrollment working if you choose database enrollment. So first go to \lib\moodlelib.php, there you should find around line 1597 the following code:

if (!empty($USER->student[$courseid]) or !empty($USER->teacher[$courseid]) or !empty($USER->admin))

And to get the metacourse enrollment working you have to insert before this the following hack:

if ($parents = get_records('course_meta', 'parent_course', $courseid)) {
if (get_record_select('user_students', "userid = $USER->id AND course = $courseid AND enrol = 'metacourse'")) $USER->student[$courseid] = 1;
}


So i think you should try this out and i would be very happy if a developer could integrate this, so i don't have to copy and paste this every time i do an update winken

Regards

Marcus
In reply to Robbie Newton

Re: Mixed Mode Enrollment

by Jeff Graham -
I posted a bug report before reading this thread bug 3974 However, I think I have exposed a similar but different bug.


I have proposed a solution to fix the enrol_student() function to be consistent with the add_teacher function. The add_teacher function defaults enrolment type to 'manual' when the parameter is not passed whereas the enrol_student function defaults to the sitewide setting 'ldap' in our case. The issue here is that the manual enrollment page 'course/student.php' does not pass a parameter for enrol type so it is set to the sitewide enrolment type of 'ldap'. What happens then is the LDAP enroll code thinks that it enrolled the student and consequently unenrolls them at login.

regards,
Jeff
In reply to Jeff Graham

Re: Mixed Mode Enrollment

by Barron Koralesky -

I think that bug #3912 also is the same bug, experienced from a different plugin.

You said that the LDAP enrol code unenrols manually-entered users at login, several of us have noticed that the database unenrol code does the same.
In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Jeff Graham -
Barron,

I think we are seeing symptoms of the same problem that are rooted outside of the enrolment plugins. The cause of the problem as I see it is that student.php or enrol_student() do not behave properly. I think the proper fix is to have enrol_student() default to setting enrol type to 'manual' if not provided rather than defaulting to the current enrol method as it currently does. This is the way that add_teacher() works.

To show the differing behavior between addteacher() and enrol_student() try the following in a course that exhibits the known problem of unenrolling students; manually add a teacher and then repeat the process that would normally unenroll a student (login as the teacher). Due to the different default behaviour of add_teacher() and enrol_student() manually enrolled teachers will remain enrolled whereas manually enrolled students will be unenrolled when their enrollment information is synced (ie. at login)

I think the bug is showing up in numerous places because of non-standard behavior of enrol_student() or a bad call to enrol_student in student.php it depends on how the core developers perceive the situation.

Regardless, in my bug report I have provided a patch for either solution. I think the patch to moodlelib.php being the more correct solution meaning that the patch to student.php would be redundant.

regards,
Jeff
In reply to Jeff Graham

Re: Mixed Mode Enrollment

by Martín Langhoff -
Jeff - thanks for the heads up! I'm going through these enrolment issues and trying to resolve them and merge them into 1.5.x.
In reply to Robbie Newton

Re: Mixed Mode Enrollment

by Martín Langhoff -
Phew! At last!

Thanks a lot everyone for the patches in the bugtracke and clear description of the problem! And I am sorry it took so long for me to have time to sit down and repro the issues and think through the different fixes.

I reworked the proposed patches a bit and tested them (well, not _that_ much). The fixes are now in MOODLE_15_STABLE and HEAD, and fix bug 3974 and bug 3912 -- which were different symptoms of the same problem.

I'm hoping this will also fix the issues Barron is discussing in other thread that I can't find right now...

cheers! martín
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -

Martín-

I'd like to try your fix.  What files did you change (so that I can test it in-situ)?  And can just those files be replaced into a 1.5.2+ install?  (This should now be in the daily builds?)



In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -
The files are, off the top of my head

- lib/moodlelib.php
- enrol/enrol.class
- enrol/db/enrol.php
- enrol/ldap/enrol.php

but you probably want to just replace your whole enrol directory with the one from the daily, to make sure you don't have any changed files there.

(I replied to this post yesterday, but my session must have timed out or something. Bah, Computers! ;)
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -

So, moodle/course/student.php was not changed?  (and those of us who altered it should revert?)

Thanks Martin!  approve
In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -
Correct - you should revert it.

If you are customizing Moodle files, you may find that it's better to use anonymous cvs, which will know which files you've modified, and merge changes when they change in the cvs repo. It'll also tell you when there's conflict - resolving the conflict remains in your hands, but it's a very helpful tool.

cheers!
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -

Martin-

I just installed a complete 1.5.2+ moodle tree (downloaded this morning, 29 Aug).  I see a similar bug:
  1. Manually add user
  2. User appears in mdl_user_students with enrol=manual
  3. User logs out
  4. User logs in, but does not see manually-enroled courses and above entries are removed from mdl_user_students
Likewise, self-enroled or key-enroled users are kicked out of classes when they log in.


In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -

Hmm - retested and cannot repro the problem. The first line of your enrol/database/enrol.php should be:

<?php  // $Id: enrol.php,v 1.7.2.1 2005/08/26 06:07:42 martinlanghoff Exp $

And the bit we really care about is:

// unenrol only if it's a record pulled from external db
if (get_record_select('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database')) {
    unenrol_student($user->id, $courseid);       /// Unenrol the student
    unset($user->student[$course->id]);           /// Remove from old list
}

Can you confirm that you're testing with the right files?

In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -
Yes, that is the file I am working with and I get the same behavior that database enrolments do not work. Manually enroled and self-enroled students are kicked out of classes when they log in.

enrol/database/enrol.php
<?php // $Id: enrol.php,v 1.7.2.1 2005/08/26 06:07:42 martinlanghoff Exp $

There is no enrol/enrol.class, but enrol/enrol.class.php is:
<?php /// $Id: enrol.class.php,v 1.20.2.1 2005/08/26 06:07:42 martinlanghoff Exp $

lib/moodlelib.php:
<?php // $Id: moodlelib.php,v 1.565.2.30 2005/08/26 06:07:40 martinlanghoff Exp $


This was a fresh install of the moodle 1.5.2+ tree as of yesterday morning, with no customizations.

Is there anything else I can test or any info that would be of help to you?


In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Barron Koralesky -

Martin-

I wonder if you or I are doing something differently that is resulting in the different behavior with regard to database enrolment.  I thought I would start over and let you know what I did, so maybe we can figure out where we differ.

I tested on a new fresh install (using the daily build from today, 30Aug, they have the change dates of 2005/08/26) on a different machine with a fresh database.

I did the following:
  1. got today's moodle
  2. made a blank database
  3. unpacked moodle & moodle-mysqladmin
  4. configured moodle via web interface
  5. added test courses
  6. configured LDAP authentication
  7. tested LDAP login with 1 user
  8. added "enrollment" table to database
  9. configured external databse enrolment (pointing to "enrollment" table in moodle's DB)
Then I did the following:
  1. logged in as admin
  2. enroled student in two classes manually
  3. logged in as student (in a different browser)
Upon login this student is not enroled in any classes.

If it would be of help, I am happy to send you login information for this server.  Please let me know.

Thanks!




In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Barron Koralesky -

I also watched what happens to mdl_user_students during this process...
  1. Admin manually enrols student in courses
  2. entries created in mdl_user_students with enrol=manual
  3. Student logs into moodle site & all new entries in mdl_user_student are removed
Note, all rows with enrol=manual for that student are removed from mdl_user_students when theat student logs in!


In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -
Good that you're keeping track of your testing routine.

You can use enrol/database and manual enrolments if you choose 'Database' and also tick enrol_allowinternal. If all goes well, in mdl_user_students the enrolments setup by enrol/database should say 'database' and the manual enrolments should say 'manual'.

What happens if you comment out the block that says 'unenrol only if yadda yadda'?
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -
You can use enrol/database and manual enrolments if you choose 'Database' and also tick enrol_allowinternal. If all goes well, in mdl_user_students the enrolments setup by enrol/database should say 'database' and the manual enrolments should say 'manual'.

Yes, I had that checked for all tests.  However, having the box checked does not fix the issue.  As a matter of fact, the behavior is the same (users kicked out of manually added classes) regardless of whether that box is checked or not.

Is this variable not being passed correctly?



In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -
What happens if you comment out the block that says 'unenrol only if yadda yadda'?

When I comment out that block the manually-enroled students are not un-enroled when they next log in.  (nor are the database users when the database changes)

Is that what is expected?


In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -

Yes, but there's something dodgy with the if(get_record()) part, and I don't quite get it.

If you split it out from

if (get_record(...)) { 

into...

  • Option A

    $rec = get_record(...);
    error_log("DEBUGGING-START-OPT A");
    error_log(print_r($rec,1));
    error_log("DEBUGGING-END");
    if ($rec->enrol === 'database') {
    
  • Option B

    $rec = get_record(...);
    error_log("DEBUGGING-START-OPT B");
    error_log(print_r($rec,1));
    error_log("DEBUGGING-END");
    if (!empty($rec)) {
    

Does either of these work any better? They will both print stuff to Apache's errorlog. Can you post the relevant part from the errorlog?

In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- Option A/B

by Barron Koralesky -

Option A

Manually added users are not deleted on login.  However, I have to say "yes" to enrol in the course (or give the enrolment key) every time I log into the course after logout.

Apache log:
[Tue Aug 30 17:23:12 2005] [error] DEBUGGING-START-OPT A
[Tue Aug 30 17:23:12 2005] [error] 
[Tue Aug 30 17:23:12 2005] [error] DEBUGGING-END

Option B
Same result

Apache log:
[Tue Aug 30 17:28:27 2005] [error] DEBUGGING-START-OPT B
[Tue Aug 30 17:28:27 2005] [error] 
[Tue Aug 30 17:28:27 2005] [error] DEBUGGING-END

I wonder if I am doing something wrong.  Just in case I attach my Option A enrol.php to this post, so you can see if I made the edits you intended.

Thank you Martin!


In reply to Barron Koralesky

Re: Mixed Mode Enrollment -- Option A/B

by Martín Langhoff -
Yep - you've tried the right thing.

It sounds like the DB data is being preserved, but the enrolment isn't being loaded into the session. A yard closer, a yard to go ;)

Let's try a different tack. Can you try with this replacement enrol/database/enrol.php ?

In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- Option A/B

by Barron Koralesky -

Martin, thank you for your work on this! I really appreciate it!

Here is what happened when I replaced the stock enrol.php with the one you posted above:
  1. log in as admin and manually enrol student into course
  2. check mdl_user_students, new student enroled, enrol=manual
  3. log in as that student
  4. student is not enroled into course (course does not appear in their "courses" block on the front page)
  5. mdl_user_students has the enrol=manual rows removed for this student
From what I can tell, this is the same behavior as before, but I can't see what is going on behind the scenes other than the changes moodle makes to mdl_user_students. There were no errors in the apache error log.
In reply to Barron Koralesky

Re: Mixed Mode Enrollment -- Option A/B

by Martín Langhoff -
Barron - no worries, we're working on thsi together ;)

#5 is a reversal on what happened with your earlier attempts, right? If you go back to the file you've uploaded before, #5 doesn't happen - can you check?

I'll have to find a bit of time to go through it again. Weird enough, it tests ok for me.
In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- Option A/B

by Barron Koralesky -
#5 is a reversal on what happened with your earlier attempts, right? If you go back to the file you've uploaded before, #5 doesn't happen - can you check?

Yes, the behavior in #5 is similar to the stock enrol.php in the 1.5.2+ distribution, and this is different that Option A/B.

With "Option A" and "Option B" manual enrolments seem to be preserved. However every time a user enters a course they have been manually enroled in they are asked "You are about to enrol yourself as a member of this course. Are you sure you wish to do this? Yes/No" They are not asked this question for courses they were enroled in via the database.

(Note, with Option A and B, it doesn't seem like users are removed from classes if I remove them from the enrolment table, but I assume that is due to the testing code you put in?)

Does this help? What does it tell you?
In reply to Barron Koralesky

Re: Mixed Mode Enrollment -- Option A/B

by Martín Langhoff -
And what about... this one ;) ?

(got my hopes up this time!)
In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- Option A/B

by Barron Koralesky -

This enrol.php results in the same behavior as Option A/B.  That is, when the student logs in they stay enroled in their manually-enroled classes, but they are asked for the key or if they want to enrol every time they log in.


In reply to Barron Koralesky

Re: Mixed Mode Enrollment -- Option A/B

by Martín Langhoff -
I actually like this one better still. smile
In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- Option A/B

by Barron Koralesky -

This results in the same behavior as the stock enrol.php from the 1.5.2 distribution.  That is, when a student logs in, they are immediately kicked out of all of their manually enroled classes.

(Martin, does any of this rely on the cron?  I was wondering if I should be running a cron between tests.)

In reply to Barron Koralesky

Re: Mixed Mode Enrollment -- Option A/B

by Tim Allen -
Hmm, this looks like a really tricky problem. mixed The bug is definitely not fixed - the same thing is happening on my site. sad

I was hoping we were on the verge of a solution, but debugging seemed to stall a few days ago. If I can help to continue the process of debugging, I would be happy to do so.

This is a really serious bug - it means that I can not use manual enrolment along with database enrolment. With a large user base, this is very inconvenient.  Right now I need to add every single enrolee to the enrolment database table, even if they are long-term users.

Tim.
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -

Perhaps this is also useful information... I notice that manually-added users are asked, "You are about to enrol yourself as a member of this course. Are you sure you wish to do this?" (or asked for the key if the course has one)

Is this supposed to happen?
In reply to Barron Koralesky

Re: Mixed Mode Enrollment

by Martín Langhoff -
That's normal ;)
In reply to Martín Langhoff

Re: Mixed Mode Enrollment

by Barron Koralesky -

Really? That is not how it used to act with internal enrolments. If an instructor has already manually enroled a student they should not be asked if they want to enrol, yes/no, right?


In reply to Robbie Newton

Re: Mixed Mode Enrollment -- fixed CVS now

by Martín Langhoff -
I have fixed this bug in CVS. The fix is essentially a cleaned up version of the last patch that I posted earlier, as part of the "Option A/B" subthread.

More detail in the bugtracker: http://moodle.org/bugs/bug.php?op=show&bugid=3912

Now - there is something funny about the last set of tests that Barron reportedly did on my patch, and I have reasons to believe he was misled by a caching issue. OTOH it could be that I'm a plain ol' idiot and haven't spotted something.

Cheers!
In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- fixed CVS now

by Dave Dave -
Hi Martin,

I just filed a bug report:

http://moodle.org/bugs/bug.php?op=show&bugid=4031

It's about the enrol.php updates... i see this both in 1.10 and 1.7.2.3. It's resulting in bad SQL statements which is causing the un-enrollment of my manual users. My manual users were still getting wiped out until I corrected the issue with the fix below. I believe it's the cause of this users problems too:

http://moodle.org/mod/forum/discuss.php?d=29929

Around line 74, it's calling the wrong datalib function. It should be calling get_record() which takes the key/value pairs instead of get_record_select():

// unenrol only if it's a record pulled from external db
if (get_record_select('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database'))
...

should be:

// unenrol only if it's a record pulled from external db
if (get_record('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database')) {




Average of ratings: Useful (1)
In reply to Dave Dave

Re: Mixed Mode Enrollment -- fixed CVS now

by Martín Langhoff -
Thanks! This slipped past me, because it errors out differently on MySQL and Postgres, apparently. On MySQL, it deletes all manual enrolments (how? why?), on Postgres it never deletes database enrolments (so expired db enrolments aren't deleted).

Anyway, it was a thinko on my part when rewriting Scott Krajewski's patch - fixed.
In reply to Martín Langhoff

Re: Mixed Mode Enrollment -- fixed CVS now

by Barron Koralesky -

Thanks Martin!

Like I said in the other forum, I just tested these and I think that you fixed the database vs. manual enrollment conflict.  Yay!

In reply to Robbie Newton

Re: Mixed Mode Enrollment

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There's much talk about this problem with 1.5.2, but I seem to be having exactly the same problem with 1.4.4. Is this the same issue or is it something else. A course not linked to the database but having an enrolment key doesn't work properly. The students have to supply the enrolment key *every* time they log in.

Will an upgrade to 1.5.2+ help?
In reply to Howard Miller

Re: Mixed Mode Enrollment

by Martín Langhoff -
Howard,

I don't think enrol/db was particularly smart about not deleting manual enrolments in 1.4.x. Definitely go for the latest 1.5.2+ (where these mixed mode enrollment issues were fixed, after several attempts and a lot of help from Barron - thanks!).