You are here

function userreference_autocomplete in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 userreference.module \userreference_autocomplete()
  2. 6.3 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

2 string references to 'userreference_autocomplete'
userreference_menu in modules/userreference/userreference.module
Implementation of hook_menu().
userreference_widget in modules/userreference/userreference.module
Implementation of hook_widget().

File

modules/userreference/userreference.module, line 435
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);
    }
  }
  drupal_json($matches);
}