AutoEnrol 1.3 Available Now!

A new version of the AutoEnrol enrolment method has been released, with support for Moodle 2.6, 2.7 and 2.8.  You can grab a copy here!

Whats New?

  • Support for Moodle 2.6, 2.7 and 2.8
  • Reworked group logic; you can now rename any automatically generated groups and newly enrolled users will still be placed correctly.
  • Group cleanup, you can set AutoEnrol to leave the groups it has created even when you delete the instance which created them.

AutoEnrol for Moodle 2.7

There’s been lots of questions and interest in AutoEnrol ever since Moodle 2.6 came out. I’ve now got some time to put together an updated version and there are a few new functions in Moodle which I want to take advantage of in the next release. My plan is to release an updated version with Moodle 2.7 compatibility in the next few weeks.

As for the longer term picture with AutoEnrol, I originally developed the plugin because I felt cohorts did not offer a flexible enough mechanism for getting users onto a course quickly. Since then cohort functionality and efficiency has improved greatly, and I am wondering whether it would be better to build a mechanism for dynamically populating cohorts so that they can be added to a course.

I’m keen to hear thoughts on this and will probably fire up a discussion on the Moodle forums soon. If you have any thoughts you would like to share now please do leave a comment for me here!

Delegated Transactions with $DB

For the last couple of days I have been working on a new plugin called “MIS Enrolment” which allows you to connect to records on an external database and then enrol users onto a Moodle course based upon their participation within that programme. The enrolment method works by allowing teachers to create an abstract “link” between their course on Moodle and their programmes held by MIS.

Enrol MIS Instance
Teacher’s admin panel for linking their Moodle courses to MIS “programmes”

This creates a many to many relationship between Moodle courses and MIS programmes and will allow teachers to easily enrol both staff and students onto the correct courses based upon the records held by an organisation’s MIS. More information to come on this over the next few weeks!

For now I am revisiting an old problem which I originally dealt with in my first month of developing for Moodle 2. In order to get this enrolment method working effectively we have to create and maintain an internal copy of the data from MIS. Normally you could just truncate (wipe clean) your records and insert them again from source, but in this case I need to compare and check:

  • What records already exist? Do they need updating?
  • What records are new? They will need inserting!
  • What records are missing from MIS? They will need archiving!

And when you are looping through 10,000 records or more this can all result in a great many individual inserts, selects and deletions. So how can you maximise the efficiency of all this? This time round I am making use of delegated transactions in Moodle to handle the bulk of database inserts.

The mechanism effectively defers all the transactions with a database to one large transaction at the end of a process. As a result you can save lots of memory and significantly reduce execution time because your script isn’t constantly waiting on the database to return some data.

For comparison I tried inserting my test participation data of 9483 new records. Using the standard DB functions the script took 47 seconds to execute, working at a steady 202 transactions per second. By comparison the delegated transaction took just 10 seconds to handle exactly the same data inserts, an effective rate of 948 inserts per second.

If you are working with large datasets on Moodle I would definitely suggest checking this functionality out as part of your project!

Try AutoEnrol 1.2 today!

AutoEnrol 1.2 Logo

 I’ve had some tremendous support and positive comments from the Moodle community since releasing AutoEnrol over a year ago. It’s clear that people are stretching the plugin and finding some pretty awesome uses for it and as such there have been a few features which seemed to be sorely missing from the plugin.

Earlier this week I released AutoEnrol 1.1 on plugins.moodle.org to purely deal with some compatibility issues with Moodle 2.5 and this remains the current stable version.

Today however I am happy to present AutoEnrol 1.2 which introduces a whole raft of new features and remains compatible with Moodle 2.0 to Moodle 2.5. Here’s a run down of what’s new:

  • It is now possible to add multiple instances to a single course.
  • Added an option to give instance a custom label.
  • Filtering functions now allow for partial matches.
  • Expanded filtering functions to include email address.
  • Added an option to limit number of enrolments. 
  • By default, users are now only enrolled if they aren’t already enrolled on a course.
  • Individual users can now be manually unenrolled through Users > Enrolled Users.
  • Where a user has the “unenrolself” permission and users are being enrolled on “Loading the Course” they can now unenrol themselves from the settings block.

AutoEnrol 1.2 Form

The plugin is available as a Release Candidate from here: AutoEnrol 1.2rc2. As ever I’m really keen to get feedback on this release, so if you have any suggestions please leave a comment!

**update: RC2 now supports self-unenrolment.

Making the most of AutoEnrol

After a year of testing I added a couple of tweaks to AutoEnrol and officially raised its status to stable. Since then the plugin has had a good amount of downloads and I really want to thank everyone for their support!

Enrolment Plugin 101

As with any enrolment plugin in Moodle 2 the administration really occurs on a course by course basis. If you go to any course which you are a teacher on and have a look under the settings block you should see course administration – users – enrolment methods. This is a new interface in Moodle 2.0.

Enrolment Methods Page

Put simply, this page will explain how users are getting access to your course. If you look under the main table you should also see a drop down menu of possible enrolment methods you can add to a course.

If you select AutoEnrol and add it to your course with the default settings it will happily get to work enrolling anyone who visits the course as a student. In the example above you can see that Auto Enrol has already successfully enrolled 5,395 users onto the course in questions (a student help course).

Getting more from AutoEnrol

There are four optional settings for AutoEnrol which are controlled by a couple of permissions. These can be revealed by clicking the show advanced option.

AutoEnrol Configuration

The first is pretty straightforward and let’s you choose the role you wish to assign to users. This is set to student by default but I have changed this to teacher in the past for setting up sandbox courses and the like.

The next option defines when the user actually gets enrolled on the course. By default this is configured to enrol a user as they load the course, which is particularly useful when the user has been provided with a direct link from either another page or course or indeed an email. Sometimes however it is useful to have a user enrolled as soon as they log into the site, for example a student help course, and this configuration also supports that option. I would recommend using this option sparingly to keep log in as short as possible.

The Less Obvious Stuff

Group By is where the really advanced techniques start. It allows you to select a particular field from the mdl_user table by which to group your users. If you have accurate department information for example you could group members of staff by their department. At BSDC we store account type in the institution field meaning we can group users into Staff or Student.

Of course once your groups are in place you can use the grouping functionality in Moodle 2 to control what some users see such as staff-only content.

The final option builds on the filter and simply allows you to filter users by a specific string. So if I wanted to only enrol students on a questionnaire course for example I would group by institution and then filter by “student”. AutoEnrol will now only enrol students on to this course

Using these two options in conjunction with some good user administration will give you a great deal of control over who can access what.