user_autocomplete

  1. drupal
    1. 4.7
    2. 5 user.module
    3. 6 user.pages.inc
    4. 7 user.pages.inc
Versions
4.7 user_autocomplete($string)
5 – 7 user_autocomplete($string = '')

Retrieve a pipe delimited string of autocomplete suggestions for existing users

Code

modules/user.module, line 2153

<?php
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();
}
?>