Moodle is a free, open-source PHP web application for producing modular internet-based courses, and is one of the most popular LMS’s in use today. This integration will help you get enrolments you take in onCourse, and automatically enrol them into the same course within Moodle.

Add a Moodle integration in onCourse automation.

Base URL
The URL of your Moodle instance. This must include the 'http://' or 'https://' protocol at the beginning of the URL.

Username & Password
The username and password used to access your Moodle instance

Service Name
The name of your integration inside Moodle.

Only activate for enrolments in courses tagged with
This defines which tag the script should look for when executing. All courses tagged with this tag will be included.

❗️

For this to work, courses to be integrated with Moodle are required to have a specific user-created tag associated with them that must be created separately in the Tags screen. You can see how to do that here. The bottom field 'Only activate for enrolments in courses tagged with' is where the name of this tag is defined, so you must make sure the name you put in here matches the name of the tag you created precisely.

Moodle integration preferences

Moodle integration preferences

Once these preferences have been defined you will need to enable the 'moodle enrol' script to automatic the process. The Moodle script can be found by going to Automation, doubling clicking on 'moodle enrol' under Scripts, clicking on the checkbox 'Enabled' and saving the script.

Moodle enrol script

Moodle enrol script

Set up Moodle

Enable the integration in Moodle:

  1. Create a user in Site administration -> Users -> Accounts -> Add a new user

    Creating a user

    Creating a user

  2. Assign user to a role in Site administration -> Users -> Permissions -> Assign system roles

  3. Add a service in Site administration -> Plugins -> Web services -> External services and give it a name.

    Adding the service

    Adding the service

  4. Once the Service is created, click on Add functions

    Functions page

    Functions page

  5. Add following functions: core_user_create_users, core_user_get_users, core_course_get_courses, enrol_manual_enrol_users

    Adding the functions to the service

    Adding the functions to the service

  6. Generate a token in Site administration -> Plugins -> Web services -> Manage tokens

    Manage tokens page

    Manage tokens page

  7. Then select the created user and service.

    Create token page

    Create token page

  8. The last step is to create a course, you can do this by going to Site administration -> Courses -> Manage courses and categories.

The ID should be the same as course code in onCourse for the default integration script to work, although you can customise this in different ways.