User autocomplete

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com我們的新網頁設計公司網頁.

function signupst_autocomp($string) {
   global $user;
  if(empty($user->uid)) {
    print drupal_to_js(array());exit();
  }
  $matches = array();
  $result = db_query("SELECT name, uid, mail FROM {users} WHERE (LOWER(name) LIKE LOWER('%%%s%%')) or (LOWER(mail) LIKE LOWER('%%%s%%') and name != '')", $string, $string);
  while ($searchuser = db_fetch_object($result)) {
    //your logic filter here
    $matches[$searchuser->name] = check_plain($searchuser->name . $emailstr . $parentstr);
  print drupal_to_js($matches);
  exit;
}
Help Share this Article