I am trying to develop a Block "course list new" that shows a list of all courses where I am enrolled as a trainer.
At the moment I use
$editingteachers = get_users_by_capability($coursecontext, 'moodle/course:manageactivities');
and this works fine. I would prefere the use of something like
$editingteachers = get_users_by_role_on_context($coursecontext);
to focus on the role instead of the capability.
Does there already exists a function like get_users_by_role_on_context($coursecontext) ?
In the screenshot you can see two red marked courses with the cabability manageactivities.
The list with only this courses is below "Übersicht über alle Kurse als Trainer".