Gareth is correct on this. Getting all course modules is very DB-intensive - get_fast_modinfo() will use the cache and is much much faster and will get you everything you should need about every course module.
Courses and course formats
Get all course modules by one sql query
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.