You are here

function userreference_autocomplete in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 modules/userreference/userreference.module \userreference_autocomplete()
  2. 6 modules/userreference/userreference.module \userreference_autocomplete()
  3. 6.2 modules/userreference/userreference.module \userreference_autocomplete()

Menu callback; Retrieve a pipe delimited string of autocomplete suggestions for existing users

1 string reference to 'userreference_autocomplete'
userreference_menu in ./userreference.module
Implementation of hook_menu().

File

./userreference.module, line 299
Defines a field type for referencing a user from a node.

Code

function userreference_autocomplete($field_name, $string = '') {
  $fields = content_fields();
  $field = $fields[$field_name];
  $matches = array();
  if ($string !== '') {
    foreach (_userreference_potential_references($field, $string) as $uid => $name) {
      $matches[$name] = check_plain($name);
    }
  }
  print drupal_to_js($matches);
  exit;
}