function course_signup_quick_register in Course 7
Same name and namespace in other branches
- 6 modules/course_signup/course_signup.module \course_signup_quick_register()
- 7.2 modules/course_signup/course_signup.module \course_signup_quick_register()
Do a quick registration.
Parameters
stdClass $node: A signup enabled course node.
stdClass $user: A user.
bool $notify: Notify the user of this signup. This is passed to signup_sign_up_user().
1 call to course_signup_quick_register()
- course_signup_course_enrollment_insert in modules/
course_signup/ course_signup.module - Implements hook_course_enroll().
File
- modules/
course_signup/ course_signup.module, line 48
Code
function course_signup_quick_register($node, $account, $notify = TRUE) {
if (!($signup = db_query('SELECT * FROM {signup_log} WHERE nid = :nid AND uid = :uid', array(
':nid' => $node->nid,
':uid' => $account->uid,
))
->fetch())) {
// Save a new signup.
if ($node->signup_status && $notify) {
// Signup is open so we can use signup's function.
signup_sign_up_user(array(
'nid' => $node->nid,
'uid' => $account->uid,
), $notify);
}
else {
// The signup was closed. Do it silently. We can't use
// signup_sign_up_user() because this would result in a
// drupal_access_denied() call.
$signup = new stdClass();
$signup->nid = $node->nid;
$signup->uid = $account->uid;
$signup->signup_time = REQUEST_TIME;
$signup->form_data = array();
$signup->count_towards_limit = 1;
signup_save_signup($signup);
$signup = signup_load_signup($signup->sid);
if ($node->signup_send_confirmation) {
signup_send_confirmation_mail($signup, $node);
}
}
}
else {
// Maybe we are "approving" an enrollment.
$signup->count_towards_limit = 1;
signup_save_signup($signup);
}
}