You are here

function course_course_enrollment_insert in Course 7

Same name and namespace in other branches
  1. 7.2 course.module \course_course_enrollment_insert()

Implements hook_course_enrollment_insert().

File

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

Code

function course_course_enrollment_insert($enrollment) {
  if (!course_report_load($enrollment->nid, $enrollment->uid)) {

    // If we don't have a course report record already, save a new one.
    $course_report = entity_create('course_report', array(
      'nid' => $enrollment->nid,
      'uid' => $enrollment->uid,
      'section_name' => 'Enrolled',
      'complete' => 0,
    ));
    $course_report
      ->save();
  }
  course_course_enrollment_update($enrollment);
}