You are here

function course_add_enrollment_action in Course 6

Same name and namespace in other branches
  1. 7.2 course.module \course_add_enrollment_action()
  2. 7 course.module \course_add_enrollment_action()

Action to enrol a user in current course.

File

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

Code

function course_add_enrollment_action($user, $context) {
  if ($node = node_load(arg(1))) {
    course_enrol($node, $user);
    drupal_set_message(t("Enrolled %name in %title.", array(
      '%name' => $user->name,
      '%title' => $node->title,
    )));
  }
}