Looking for something similar but for a
dashboard link which takes the user to their first incomplete course module.
I've figured out how to check the user's enrolled courses by calling enrol_get_my_courses to generate an array of the user's courses, and then iterating through the array looking for the course ID matching the course name, then using the Course ID to build the link.
But how do I dynamically generate the link to the next unfinished course module?
Is there a built in Moodle function that takes in the course ID as an argument and returns the url of the user's next unfinished cm/cmid where I can get the $page info?
Or do we have to dig through the database to find that information?
(ie: a join on course_module_completion for the completion state, and course
sections for the course module sequence, and then go looking for the $page ...)
My ultimate goal is:
If the user has finished course section 3, module 2 (assignment 1), the link will point to module 3 (assignment 2). When they finish that, it points to section 3, module 3 (section 3 quiz). When they complete the quiz, the link points to section 4 module 1 (introduction lecture), etc...