Hello,
I am struggling with a little issue. I want to use an "if" function to test if the current user is enroled as a teacher in at least one of the courses available on my moodle installation.
I am trying with the has_capability function, but which capability and especially which context can I use to make my function work with all the users who are enroled in a course, even if they are not browsing this course page when the function is called?
I have found tons of information, but still nothing that answers my question. I understood that the legacy roles couldn't be used any longer, and I understand the limits of thinking in terms of roles rather than capabilities. However, what I need here is precisely to know if my user has a teacher role.
I would greatly appreciate your help to better understand this problem!