Sometimes is_available() is called when the global COURSE var has an id of 1, for example calendar events or accessing the activity with a direct link. This means the activity isn't completely restricted.
I've extracted the course from the \core_availability\info passed and used it to get the correct course id while also falling back to the global COURSE if no course is passed down to get_reference_date().
Sometimes is_available() is called when the global COURSE var has an id of 1, for example calendar events or accessing the activity with a direct link. This means the activity isn't completely restricted.
I've extracted the course from the \core_availability\info passed and used it to get the correct course id while also falling back to the global COURSE if no course is passed down to get_reference_date().