function invite_user_insert in Invite 8
Same name and namespace in other branches
- 7.4 invite.module \invite_user_insert()
- 7.2 invite.module \invite_user_insert()
Implements hook_user_insert().
File
- ./
invite.module, line 38 - Default file for Invite Project.
Code
function invite_user_insert(User $account) {
if (!empty($_SESSION['invite_code'])) {
// Update invite when user accepts.
$id = Drupal::entityQuery('invite')
->condition('reg_code', $_SESSION['invite_code'])
->execute();
$invite = Invite::load(reset($id));
$invite
->setInvitee($account);
$invite
->save();
unset($_SESSION['invite_code']);
}
}