function course_signup_course_enrol in Course 6
Implements hook_course_enrol().
If a user is enrolled outside of signup, sign them up as well.
File
- modules/
course_signup/ course_signup.module, line 195
Code
function course_signup_course_enrol($node, $user, $from, $code, $status) {
// Check if uc_signup is enabled and this enrollment is from ubercart. If it
// is, we don't want to sign the user up, because uc_signup will convert the
// temporary signup and create a duplicate.
$uc_signup = module_exists('uc_signup') && $from == 'ubercart' && isset($_SESSION['uc_signup']);
$uc_sid = FALSE;
if ($uc_signup) {
$sql = "SELECT ucsl.sid FROM {uc_signup_log} ucsl\n LEFT JOIN {signup_log} sl USING (sid)\n WHERE sl.nid = %d AND sl.uid = %d";
$uc_sid = db_result(db_query($sql, $node->nid, $user->uid));
}
if ($from != 'course_signup' && !$uc_sid) {
course_signup_quick_register($node, $user);
}
}