Configure Your WordPress Site
1. Moodle Settings: Fill up “Access URL” and “Webservice token” fields. “Access URL” would be the site url of your Moodle instance and you have to generate the web service token from your Moodle instance (the steps to generate web service token has been discussed below).
2. WooCommerce Product Settings: If you want to create products(in WooCommerce) from courses synced from your Moodle instance during synchronization then check “Create products from courses” checkbox; otherwise leave it unchecked. In the second case the courses (synced from your Moodle instance) will be saved as posts in the WP site and you may create products for those courses later as per your requirement.
3. User Settings: If “Update user info with order info” is checked, the users’ info will be updated with their billing info every time they purchase a course.
By default, this plugin sends the role of a user as a student to the Moodle instance. The “Moodle user role in a course” field may be left blank if you want it to remain that way. If you want the user to be enrolled in a course in a custom role or in a role other than “Student”, then put that user role id in this field.
Select “Yes” from options and click on “Synchronize” button to sync course categories and courses from your moodle site.
Configure Your Moodle Site
1. Enable Web Service: Go to Site administration > Advanced features > Check “Enable web service” checkbox and then click on “Save changes” (at the bottom of the page) to enable web service in your Moodle instance.
2. Enable Required Web Service protocol: Go to Site administration > Plugins > Web service > Manage protocols > Click on the eye icon in the “REST protocol” row to enable the protocol (required for web service) and then “Save changes”.
3. Add A Service: Go to Site administration > Plugins > Web service > External services > Click on “Add” link under “Custom services” to add your service.
4. Setup Your Service: Give a name to your service, check the “Enabled” checkbox then click on “Add service” to add the service. Add a name that should help you track how this webservice is being used.
5. Add Required Function To Your Service: Click on “Add functions” link.
Now add the following functions to your service:
core_user_create_users: Create users
core_course_get_courses: Return course details
core_course_get_categories: Return category details
enrol_manual_enrol_users: Manual enrol users
6. Create A Web Service Token: Go to Site administration > Plugins > Web service > Manage tokens > Click on “Add” link.
(Copy this token and put in “Webservice token” field in MooWoodle plugin settings.)
7. Disable Password Policy Of Moodle: The password for new users will be generated at the WordPress end and it might not match the default password policy of Moodle; in that case Moodle will not allow creation of new user through web service. To prevent such incident you need to disable password policy checking. To disable password policy go to Site Administration > Security > Site policies > Uncheck “Password policy” checkbox and click on “Save changes” button.