function _fbconnect_get_username in Facebook Connect 8.2
Same name and namespace in other branches
- 6.2 fbconnect.pages.inc \_fbconnect_get_username()
- 7.2 fbconnect_login/fbconnect_login.pages.inc \_fbconnect_get_username()
Returns a name suggestion if the wanted username is already used.
1 call to _fbconnect_get_username()
- fbconnect_login_authorize_page in fbconnect_login/
fbconnect_login.pages.inc - Menu callback. Called when user perform Facebook registration
File
- fbconnect_login/
fbconnect_login.pages.inc, line 219 - User pages callbacks for the fbconnect module.
Code
function _fbconnect_get_username($name_suggestion) {
$query = db_select('users', 'u');
$query
->condition('name', $name_suggestion);
$query
->fields('u', array(
'name',
));
$query
->countQuery();
$result = $query
->execute()
->fetchField();
if ($result) {
$counter = variable_get('fbconnect_namecounter', 1);
$newname = 'fbuser' . $counter;
$counter++;
variable_set('fbconnect_namecounter', $counter);
}
else {
$newname = $name_suggestion;
}
return $newname;
}