You are here

function _fbconnect_get_username in Facebook Connect 6.2

Same name and namespace in other branches
  1. 8.2 fbconnect_login/fbconnect_login.pages.inc \_fbconnect_get_username()
  2. 7.2 fbconnect_login/fbconnect_login.pages.inc \_fbconnect_get_username()

@todo.

1 call to _fbconnect_get_username()
fbconnect_register_page in ./fbconnect.pages.inc
Menu callback. Called when user perform facebook registration

File

./fbconnect.pages.inc, line 125
User pages callbacks for the fbconnect module.

Code

function _fbconnect_get_username($name_suggestion) {
  $query = "SELECT COUNT(name) FROM {users} WHERE name = '%s'";
  $result = db_result(db_query($query, $name_suggestion));
  if ($result['name'] != 0) {
    $counter = variable_get('fbconnect_namecounter', 1);
    $newname = 'fbuser' . $counter;
    $counter++;
    variable_set('fbconnect_namecounter', $counter);
  }
  else {
    $newname = $name_suggestion;
  }
  return $newname;
}