You are here

function course_signup_confirmation_form_submit in Course 7.2

Submit callback for code form.

File

modules/course_signup/course_signup.module, line 507

Code

function course_signup_confirmation_form_submit($form, &$form_state) {
  global $user;
  $nid = _signup_check_code($form_state['values']['code']);
  $course_node = node_load($nid);
  course_enroll($course_node, $user, 'course_signup_code');
  $enrollment = course_enrollment_load($course_node, $user);
  course_signup_mark_attended_action($enrollment, []);
  $tokens['user'] = $user;
  $tokens['node'] = $course_node;
  drupal_set_message(_signup_sms_get_message('confirmation_registered', $tokens));
}