You are here

function course_signup_migrate_enrollments in Course 6

Same name and namespace in other branches
  1. 7.2 modules/course_signup/course_signup.module \course_signup_migrate_enrollments()
  2. 7 modules/course_signup/course_signup.module \course_signup_migrate_enrollments()

Create a signup for every enrollment.

File

modules/course_signup/course_signup.module, line 285

Code

function course_signup_migrate_enrollments() {
  if (db_table_exists('course_enrolment') && db_table_exists('signup_log')) {

    // Ensure a signup exists for each full course enrollment.
    $sql = "SELECT ce.* FROM {course_enrolment} ce\n    LEFT JOIN {signup_log} sl ON (ce.nid = sl.nid AND ce.uid = sl.uid)\n    where sid is null and ce.status";
    $result = db_query($sql);
    while ($row = db_fetch_object($result)) {
      $row->signup_time = $row->timestamp;
      drupal_write_record('signup_log', $row);
    }
  }
}