You are here

function invite_user_insert in Invite 7.2

Same name and namespace in other branches
  1. 8 invite.module \invite_user_insert()
  2. 7.4 invite.module \invite_user_insert()

Implements hook_user_insert().

File

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

Code

function invite_user_insert(&$edit, $account, $category) {
  $invite = invite_find_invite($account->mail);
  if ($invite) {
    invite_process_invite($invite, $account);
    module_invoke_all('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(
        'data' => array(
          'invite_accepted' => TRUE,
        ),
      ));
    }
    if (isset($_SESSION)) {
      unset($_SESSION[INVITE_SESSION]);
    }
  }
}