Profile Field Enrolment is a Moodle plugin that Refined Training has enhanced. Created to enrol users with certain values in their profile into a particular course, the enhanced version can be used to indicate required or recommended courses for users. Moreover, multiple instances of the enrolment method can be added to the same course to enrol certain users in to the course automatically when cron runs, to recommend the course to other groups of users and to require enrolment for still other users, depending upon different values in different profile fields.
Blocks on the front page display designated Recommended and Required courses to users whose profile fields values match the criteria for enrolment into the courses. The blocks also indicate the activity completion status of courses the users are enrolled in and provide a link to a dashboard summary of courses.
TABLE OF CONTENTS:
Setting up Required and Recommended Course Blocks on the Front Page
To set up recommended and required courses blocks for users who meet the criteria for enrolment into the course, you need to add the blocks to the front page. On the front page, turn editing on and scroll down to find the option to Add a block. Click on the drop-down menu to add the recommended courses and/or required courses blocks to the Front Page:

You can add only one instance of Required Courses and one instance of Recommended Courses blocks.
You need to configure the settings for each block before using them. First set up the required Courses block. Go to Administration>>> Site administration>>> Plugins>>> Blocks:

Select Required Courses Block:

The two most important settings on this page are:
- Allow courses to be removed – By default, the option is set to No. If you want to give users the ability to remove Required Courses from the block, change to Yes.
- User Check time – How often the system will update the block. By default the system updates the block once every 24 hours, when the user accesses the block. The shortest time you can set is once every hour. More frequent checks can slow the system if there are a lot of users with accounts on the site. Whatever frequency is set here also determines the frequency of checks for the Recommended Courses Block, too.
- Display activity completion – If set to Yes, users will see how many activities they have completed in a course. Only those activities that have Completion Criteria set will appear in the list.
Be sure to Save changes before leaving the page.
Then configure the settings for the Recommended Courses block:

Revise settings as desired. Save changes before leaving page.
In the blocks, users will see courses that are required or recommended, whether or not they’ve enrolled, and how many activities in the course they have completed. For example:

The green checkmark indicates that the user has enrolled in the course already, the 2 of 4 or 0 of 0 indicates the number of activities complete and, in the Recommended Courses block, the grey X indicates that the user can removed the course from their view in the Recommended Courses block.
Both blocks contain a link to Complete Listing. When they click on it, they see a chart of all required or recommended courses (depending on the tab selected) and their progress:

On the Completed tab, they will see a list of completed courses. All courses with completion criteria set that the user has completed will appear under this tab, whether the courses are recommended or required or not:

| As a rule, we recommend that, for every course, you always set completion criteria inside the Course completion set-up (inside Course administration menu). |
To Designate a Course as Recommended
The set-up for Recommended enrolment is similar to that for Enrol users, except that you enable the Recommended box instead of the Enrol user box:

When a user whose profile matches the expected value(s) for the particular user profile field(s) logs in to the site, he or she will see the course in their Recommended Courses block. If the user clicks on the course name, he or she will see the following message on the course enrolment page:

He or she will be able to enrol in the course and, if you wish to place him or her in a group, you can provide the group password (set inside the Create group set-up page as the Enrolment key) to the potential student ahead of time. If you wish to distribute students into more than one Group, do not designate a Default Group for the course in the course settings (see Default Group for more information).
When a user whose profile does not match the expected value for the particular user profile field accesses the course from a list or link, he or she will see a message that they are not allowed to enrol on the course enrolment page:

Such users will not be able to enrol in the course.
To Designate a Course as Required
The set-up for enrolment into Required courses is similar to that for Recommended users, except that you enable the Required box instead of the Recommended box:

When a user whose profile matches the expected value(s) for the particular user profile field(s) logs in to the site, he or she will see the course in their Required Courses block. If the user clicks on the course name, he or she will see the following message on the course enrolment page:

He or she will be able to enrol in the course and, if you wish to place him or her in a group, you can provide the group password (set inside the Create group set-up page as the Enrolment key) to the potential student ahead of time. If you wish to distribute students into more than one group, do not designate a Default Group for the course in the course settings (see Default Group for more information).
When a user whose profile does not match the expected value for the particular user profile field accesses the course, he or she will see the following message on the course enrolment page:

Such users will not be able to enrol in the course.
Note about Country Codes
If you use Country as the profile field for designation, you must enter the country as a two-letter code. To determine the correct two-letter code, check the associated language strings. Go to Site administration>>> Language>>> Language customization>>> Core: countries.php. If desired, the country code can be revised in the language string.