You are here

function course_uc_course_enrollment_insert in Course 7

Same name and namespace in other branches
  1. 8.3 modules/course_uc/course_uc.module \course_uc_course_enrollment_insert()
  2. 8.2 modules/course_uc/course_uc.module \course_uc_course_enrollment_insert()
  3. 7.2 modules/course_uc/course_uc.module \course_uc_course_enrollment_insert()
  4. 3.x modules/course_uc/course_uc.module \course_uc_course_enrollment_insert()

Implements hook_course_enroll().

Satisfy payment requirement when manually enrolled.

File

modules/course_uc/course_uc.module, line 202

Code

function course_uc_course_enrollment_insert($enrollment) {
  $node = node_load($enrollment->nid);
  $user = user_load($enrollment->uid);
  $course = course_get_course($node);
  if (course_uc_payment_is_first($course)) {
    foreach ($course
      ->getObjects() as $courseObject) {
      $courseObject
        ->getFulfillment($user)
        ->setComplete(TRUE)
        ->save();
      break;
    }
  }
}