A more robust method for automating enrollments is the external database enrollment plugin. The external database enrollment plugin is similar to the external database authentication plugin, which we discussed earlier in this chapter. Moodle can use a table in an external database to assign users to courses with the proper role. You or your IT department can create the table from a number of sources, including HR, portal, or e-commerce systems. The table can be relatively simple, with just a few columns with the necessary data.
Using a database table has a few advantages over using a flat file. While the flat file is easy to create, database enrollment is usually easier to manage. Adding or removing a user can be done with a simple SQL command, instead of editing a text file. The database plugin can also create new courses if the course in the enrollment table doesn't already exist in Moodle.
To configure the database plugin...