You are here

function _uuid_link_autocomplete_user in UUID Link 6

Callback for auto completing user links.

Parameters

string $string: The partial string to auto complete.

Return value

array An associative array of uuid => username.

1 call to _uuid_link_autocomplete_user()
uuid_link_autocomplete in ./uuid_link.module
Autocomplete callback for entities.

File

./uuid_link.module, line 343
Provides a filter and UI for adding links to entities that are not affected by changes in URL alias.

Code

function _uuid_link_autocomplete_user($string) {
  $matches = array();
  $query = "SELECT DISTINCT(uu.uuid), name, language FROM {users} u INNER JOIN {uuid_users} uu ON u.uid = uu.uid";
  $query .= " WHERE u.name LIKE '%s%%'";

  // Only search for published nodes.
  $query .= " AND u.status = 1";
  $query .= " ORDER BY u.name";
  $result = db_query_range(db_rewrite_sql($query), $string, 0, 15);
  while ($row = db_fetch_object($result)) {
    $matches[$row->uuid] = check_plain($row->name);
  }
  return $matches;
}