You are here

function _cmf_user_autocomplete in Content Management Filter 5

Same name and namespace in other branches
  1. 6.2 cmf.module \_cmf_user_autocomplete()
  2. 6 cmf.module \_cmf_user_autocomplete()
  3. 7 cmf.module \_cmf_user_autocomplete()

Menu callback; Retrieve a JSON object containing autocomplete suggestions for existing users.

1 string reference to '_cmf_user_autocomplete'
cmf_menu in ./cmf.module
Implementation of hook_menu().

File

./cmf.module, line 644
@brief Content management filter module file

Code

function _cmf_user_autocomplete($string = '') {
  $matches = array();
  if ($string) {
    $result = db_query("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string);
    while ($account = db_fetch_object($result)) {
      $matches[$account->name] = check_plain($account->name);
    }
  }
  print drupal_to_js($matches);
  exit;
}