first, I have a teacher's login. I need to get the list of the courses where this user is a teacher, then get a list of participants for each course. Which API calls should I use?
I thought I'd use core_enrol_get_users_courses but it doesn't mark user's role in the course.
First: core_enrol_get_users_courses for returning all the courses
Next: Get all the participants of that courses using the function: core_enrol_get_enrolled_users (passing as argument withcapability a capability your teachers must have)
And then iterate the courses/users and discard the courses where the user was not returned by the enrolled_users funciton
hello Jury, I reviewed your old post and not if you've already solved, I developed a new function for web services which returns the list of courses in which a user has the role of editingteacher, this list is returned as a string serialized (json) with the id and the shortname of the course. although it can be modified to return more values.
The service is based on the example and documentation Moodle: https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin and https://github.com/moodlehq/moodle-local_wstemplate
Deputy .zip service
Sorry for my English