You are here

function regcode_user_insert in Registration codes 7

Same name and namespace in other branches
  1. 7.2 regcode.module \regcode_user_insert()

Implements hook_user_insert().

File

./regcode.module, line 209
Main functionality and hooks of regcode module.

Code

function regcode_user_insert(&$edit, $account) {
  $account->regcode = FALSE;
  if (empty($edit['regcode'])) {
    return;
  }
  $code = regcode_code_consume($edit['regcode'], $account->uid);
  if ($code) {
    $account->regcode = $code;
  }
  watchdog('regcode', 'The registration code %code was used by !user', array(
    '%code' => $edit['regcode'],
    '!user' => l($account->name, 'user/' . $account->uid),
  ));

  /*
   * Modules are expected to "consume" any data in the $edit array once it
   * has been used.
   */
  $edit['code'] = NULL;
}