You are here

function course_enrollment_check in Course 8.2

Same name and namespace in other branches
  1. 8.3 course.module \course_enrollment_check()
  2. 7.2 course.module \course_enrollment_check()
  3. 7 course.module \course_enrollment_check()

Check if the user has enrolled in a course.

Parameters

mixed $nid: A course node ID.

mixed $uid: A user ID.

Return value

bool TRUE if the user is enrolled, FALSE otherwise.

Deprecated

Use Course::isEnrolled($account);

3 calls to course_enrollment_check()
course_rules_condition_course_enrollment_check in includes/course.rules.inc
Rules condition handler to check enrollment.
course_uc_course_access in modules/course_uc/course_uc.module
Implements hook_course_access().
course_uc_form_alter in modules/course_uc/course_uc.module
Implements hook_form_alter().

File

./course.module, line 239
course.module Core functionality for Courses.

Code

function course_enrollment_check(Course $course, AccountInterface $account) {
  return $course
    ->isEnrolled($account);
}