function course_user_delete in Course 8.2
Same name and namespace in other branches
- 8.3 course.module \course_user_delete()
- 7.2 course.module \course_user_delete()
- 7 course.module \course_user_delete()
- 3.x course.module \course_user_delete()
Implements hook_user_delete().
Clean up course reports and fulfillments for a deleted user.
File
- ./
course.module, line 805 - course.module Core functionality for Courses.
Code
function course_user_delete($account) {
$result = Drupal::database()
->query("SELECT * FROM {course_enrollment} WHERE uid = :uid", array(
':uid' => $account->uid,
));
while ($enrollment = $result
->fetch()) {
$node = Node::load($enrollment->nid);
course_unenroll($node, $account);
}
}