User enrolments with roles

User enrolments with roles

by Mats Magnem -
Number of replies: 0

Hi

I am using the Moodle API to get the courses that a user is enrolled in. I use the wsfunction "core_enrol_get_users_courses" to do this. I am using a token that belongs to a "service/admin user" and not the actual user, using the "moodle_mobile_app" service. I don't have access to the database, only the Moodle API.

But by using core_enrol_get_users_courses, it seems like it will return all courses without any role definition or status. I would like to get only the courses that the user is f.ex "teacher" or "editingteacher". Or in another scenario, only the courses where the user is "student" or "guest".

Another thing I would like is to only get courses that are in progress. Aka not courses that are marked "hidden" or has an "enddate" back in time or "startdate" in the future.

Is that possible to get through the API without having customizations to the Moodle installation?

Average of ratings: -