I am currently adapting the accordion resource (here) to display a list of courses associated with another course through meta courses.
Through my adaptation, I have been able to do this and display all of the courses and whether the courses are visible or hidden.
However, I am unsure how to code hiding the non-visible courses from those who should not be able to see them and displaying them for those who should.
I know that I have to use the has_capability function, but not sure how to reference that back to the child course rather than the current course.
Anyone any ideas/help/suggestions?
Using Moodle 1.9.11+ if that makes any difference.