function invite_user in Invite 5.2
Same name and namespace in other branches
- 5 invite.module \invite_user()
- 6.2 invite.module \invite_user()
Implementation of hook_user().
File
- ./
invite.module, line 382 - Allows your users to send and track invitations to join your site.
Code
function invite_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$invite = invite_load_from_session();
if (!$invite) {
// Try to look up an invitation in case a user has been invited to join
// the site, but did go straight to the site and signed up without
// using the invite link.
$code = db_result(db_query("SELECT reg_code FROM {invite} WHERE email = '%s'", $account->mail));
if ($code) {
$invite = invite_load($code);
}
}
if ($invite) {
invite_accept($invite, $account);
// Flag the inviting user, this triggers status notifications and
// saves us some queries otherwise.
if ($invite->inviter->uid) {
user_save($invite->inviter, array(
'invite_sent' => TRUE,
));
}
unset($_SESSION[INVITE_SESSION]);
}
break;
case 'delete':
invite_delete($account->uid);
break;
}
}