On a Moodle-enabled site, I want to give users some coupons.
I made it to check if the user is logged in, but I also want to check if the current logged in user is enroled in specific course (an array of 3 course IDs).
So far I tried with $USER->currentcourseaccess
or $USER-> lastcourseaccess
, but they don't do the trick.
So, how can I check if the current logged in user is enrolled in specific Moodle course?
Edit: The site uses Moodle 2.