vfremaux / moodle-availability_days

Allows activating activities or sections at a delayed day offset from course aperture
9 stars 14 forks source link

Fixing correct date being returned when global course is set to ID 1 #17

Open rhell4 opened 5 years ago

rhell4 commented 5 years ago

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().