function course_signup_signup_enroll in Course 7
Same name and namespace in other branches
- 6 modules/course_signup/course_signup.module \course_signup_signup_enroll()
- 7.2 modules/course_signup/course_signup.module \course_signup_signup_enroll()
Helper signup course enroll criteria function for insert & update.
See also
2 calls to course_signup_signup_enroll()
- course_signup_signup_insert in modules/
course_signup/ course_signup.module - Implements hook_signup_insert().
- course_signup_signup_update in modules/
course_signup/ course_signup.module - Implements hook_signup_update().
File
- modules/
course_signup/ course_signup.module, line 118
Code
function course_signup_signup_enroll($signup) {
if ($enrollment = course_enrollment_load($signup->nid, $signup->uid)) {
// Found an enrollment already.
if (!$enrollment->status) {
// Don't process this enrollment, because it was marked as inactive.
return;
}
}
if ($signup->uid && $signup->nid && $signup->count_towards_limit && empty($signup->anon_mail)) {
$node = node_load($signup->nid);
if (course_node_is_course($node)) {
$user = user_load($signup->uid);
course_enroll($node, $user, 'course_signup');
}
}
}