You are here

function course_add_enrollment_action in Course 7

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

Action to enroll a user in current course.

File

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

Code

function course_add_enrollment_action($user, $context, $x) {
  $node = node_load($context['view_info']['arguments'][0]);
  course_enroll($node, $user, 'course_add_enrollment_action');
  drupal_set_message(t("Enrolled %name in %title.", array(
    '%name' => $user->name,
    '%title' => $node->title,
  )));
}