user_autocomplete

5 user.module user_autocomplete($string = '')
6 user.pages.inc user_autocomplete($string = '')
7 user.pages.inc user_autocomplete($string = '')
8 user.pages.inc user_autocomplete($string = '')

Retrieve a pipe delimited string of autocomplete suggestions for existing users

1 string reference to 'user_autocomplete'

File

modules/user/user.module, line 2493
Enables the user registration and login system.

Code

function user_autocomplete($string = '') {
  $matches = array();
  if ($string) {
    $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
    while ($user = db_fetch_object($result)) {
      $matches[$user->name] = check_plain($user->name);
    }
  }
  print drupal_to_js($matches);
  exit();
}
Login or register to post comments