You are here

function course_unenroll in Course 7.2

Same name and namespace in other branches
  1. 8.3 course.module \course_unenroll()
  2. 8.2 course.module \course_unenroll()
  3. 7 course.module \course_unenroll()
  4. 3.x course.module \course_unenroll()

Un-enroll the user.

Deletes course report entries, course enrollments, and object fulfillment records.

Parameters

object $node: A course node.

object $user: A user.

Return value

bool TRUE if user is un-enrolled, FALSE if node is not a course.

5 calls to course_unenroll()
course_remove_enrollment_action in ./course.module
course_rules_action_course_unenroll in includes/course.rules.inc
Rules action handler for unenrollment.
course_signup_signup_cancel in modules/course_signup/course_signup.module
Implements hook_signup_cancel().
course_signup_signup_delete in modules/course_signup/course_signup.module
Implements hook_signup_delete().
course_user_delete in ./course.module
Implements hook_user_delete().

File

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

Code

function course_unenroll($node, $user) {
  if ($enrollment = course_enrollment_load($node->nid, $user->uid)) {
    return $enrollment
      ->delete();
  }
}