You are here

function invite_process_invite in Invite 7.2

Process a user that accepted an invitation.

Parameters

$invite: An invite object.

$account: The user object that accepted the invitation.

1 call to invite_process_invite()
invite_user_insert in ./invite.module
Implements hook_user_insert().

File

./invite.module, line 740
Allows your users to send and track invitations to join your site.

Code

function invite_process_invite($invite, $account) {

  // Update the invitation record.
  db_query("UPDATE {invite} SET email = :email, invitee = :invitee, joined = :joined WHERE reg_code = :reg_code", array(
    ':email' => $account->mail,
    ':invitee' => $account->uid,
    ':joined' => REQUEST_TIME,
    ':reg_code' => $invite->reg_code,
  ));

  // Add all users who invited this particular e-mail address to the
  // notification queue.
  db_query("INSERT INTO {invite_notifications} (uid, invitee) SELECT uid, :uid FROM {invite} WHERE (email = :invite_email OR email = :account_mail) AND canceled = 0", array(
    ':uid' => $account->uid,
    ':invite_email' => $invite->email,
    ':account_mail' => $account->mail,
  ));
}