You are here

function course_uc_course_enrol in Course 6

Implements hook_course_enrol().

Satisfy payment requirement when manually enrolled.

File

modules/course_uc/course_uc.module, line 123

Code

function course_uc_course_enrol($node, $user) {
  $course = course_get_course($node, $user);
  foreach ($course
    ->getObjects() as $idx => $courseObject) {
    if ($idx == 0 && $courseObject
      ->getComponent() == 'payment') {
      $courseObject
        ->getFulfillment()
        ->setComplete(TRUE)
        ->save();
    }
  }
}