function uc_coupon_workflow_assign in Ubercart Discount Coupons 7.2
Same name and namespace in other branches
- 7.3 uc_coupon_workflow/uc_coupon_workflow.rules.inc \uc_coupon_workflow_assign()
Action callback to assign a coupon to a user.
File
- uc_coupon_workflow/
uc_coupon_workflow.rules.inc, line 208 - Rules integration for uc_coupon_workflow
Code
function uc_coupon_workflow_assign($account, $cid) {
$coupon = uc_coupon_load($cid);
if ($coupon->cid) {
// Grant access to the coupon.
$coupon->data['users'][$account->uid] = $account->uid;
uc_coupon_save($coupon);
return array(
'coupon' => $coupon,
);
}
else {
return array(
'coupon' => NULL,
);
}
}