function invite_generate_code in Invite 7.2
Same name and namespace in other branches
- 5.2 invite.module \invite_generate_code()
- 6.2 invite.module \invite_generate_code()
- 7.4 includes/invite.controller.inc \invite_generate_code()
Generates a unique tracking code.
Return value
An 8-digit unique tracking code.
1 call to invite_generate_code()
- invite_create in ./
invite.module - Creates an empty invite object.
File
- ./
invite.module, line 1474 - Allows your users to send and track invitations to join your site.
Code
function invite_generate_code() {
do {
$reg_code = user_password(8);
$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;
}