You are here

function course_user in Course 6

Implements hook_user().

Delete the user's course records, fulfillments, and enrollments upon deletion.

File

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

Code

function course_user($op, &$edit, &$account, $category = NULL) {
  if ($op == 'delete') {
    $sql = "DELETE FROM {course_report} WHERE uid = %d";
    db_query($sql, $account->uid);
    $sql = "DELETE FROM {course_outline_fulfillment} WHERE uid = %d";
    db_query($sql, $account->uid);
    $sql = "SELECT * FROM {course_enrolment} WHERE uid = %d";
    $result = db_query($sql, $account->uid);
    while ($enrollment = db_fetch_object($result)) {
      $node = node_load($enrollment->nid);
      course_unenrol($node, $account);
    }
  }
}