function uc_coupon_register_user in Ubercart Discount Coupons 6
Implementation of hook_user().
File
- uc_coupon_register/
uc_coupon_register.module, line 73
Code
function uc_coupon_register_user($type, &$edit, &$account, $category = NULL) {
if ($type == 'insert') {
if (isset($edit['uc_coupon_register']) && $edit['uc_coupon_register']) {
$uid = $edit['uid'];
// Grant access to the coupon.
$coupon = uc_coupon_load(variable_get('uc_coupon_register_cid', 0));
if ($coupon->cid) {
$coupon->data['users'][$uid] = $uid;
uc_coupon_save($coupon);
// Send the email.
$params['account'] = $account;
$params['coupon'] = $coupon;
drupal_mail('uc_coupon_register', 'coupon', $account->mail, user_preferred_language($account), $params);
}
}
$edit['uc_coupon_register'] = NULL;
}
}