You are here

function invite_generate_code in Invite 7.4

Same name and namespace in other branches
  1. 5.2 invite.module \invite_generate_code()
  2. 6.2 invite.module \invite_generate_code()
  3. 7.2 invite.module \invite_generate_code()

Generates a unique tracking code.

Return value

string An 10-digit unique tracking code.

1 call to invite_generate_code()
InviteController::create in includes/invite.controller.inc
Implements EntityAPIControllerInterface.

File

includes/invite.controller.inc, line 324

Code

function invite_generate_code() {
  do {
    $reg_code = user_password(10);
    $result = (bool) db_query_range('SELECT reg_code FROM {invite} WHERE reg_code = :regcode', 0, 1, array(
      ':regcode' => $reg_code,
    ))
      ->fetchField();
  } while ($result);
  return $reg_code;
}