The course_parent_visible() in require_login() adds two BD queries on each page, any query dealing with my courses has the same problems with unnecessary nested visibility checks for each course - major problem for paging...
The solution is to use the course_categories.visible only when browsing category contents - see the original implementation of allowvisiblecoursesinhiddencategories setting.
2/ simplified code
3/ it is possible to hide courses user is not enrolled in, but still allow access and listing of all my enrolled courses that are not hidden
4/ hopefully better visualisation of course availability states and more flexibility
- tweak require_login() and other places that are checking parent categories
- keep category visibility checks only when browsing course categories
- implement new category+course hiding/unhiding logic - needs new visibleold flag in course and course_categories table