1

We have 2 application one is main application and second is moodle 3.6, we want to trigger a callback from Moodle to our main application when a user starts a course or complete a course, How to implement this functionality.

Thanks in advance.

Nithee
  • 300
  • 1
  • 12

1 Answers1

1

You may code it along this lines:

  1. Create a plugin for Moodle, if you are just handling this "event emission" thing, you may just make a "local plugin" (https://docs.moodle.org/dev/Local_plugins). I recommend you to use a plugin skeleton generator to generate the boilerplate code for the plugin: https://moodle.org/plugins/tool_pluginskel
  2. In your plugin, register the event observers for the relevant core events (documentation here: https://docs.moodle.org/dev/Event_2#Event_observers ). For example: course_completed would be an straightforward one according to your needs. You have a list of events here: https://docs.moodle.org/dev/Event_2#Existing_events .
  3. From the listener method linked to the observer you can make the relevant external calls to your main app.
Mitxel
  • 425
  • 2
  • 7
  • Hi, I need to react on user completing course or quiz and pass the information of the completion to my API (ASP .NET WebAPI). AFAIK the minimal info I need to pass is UserID and CourseID (and then in my WebAPI I can call Moodle API to get information about the course, user and read this user's score). Do you know how can I got this info in my event observer? – Aenye_Cerbin Aug 27 '23 at 14:38