title: Check if user is enrolled in specific Moodle course
body: <p>On a Moodle-enabled site, I want to give users some coupons.  </p>
  
  <p>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).</p>
  
  <p>So far I tried with <code>$USER-&gt;currentcourseaccess</code> or <code>$USER-&gt; lastcourseaccess</code>, but they don't do the trick.</p>
  
  <p>So, how can I check if the current logged in user is enrolled in specific Moodle course?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> The site uses <em>Moodle 2</em>.</p>