function masquerade_autocomplete in Masquerade 6
Same name and namespace in other branches
- 5 masquerade.module \masquerade_autocomplete()
- 7 masquerade.module \masquerade_autocomplete()
Returns JS array for Masquerade autocomplete fields.
1 string reference to 'masquerade_autocomplete'
- masquerade_menu in ./
masquerade.module - Implementation of hook_menu().
File
- ./
masquerade.module, line 578 - masquerade.module
Code
function masquerade_autocomplete($string) {
$matches = array();
$result = db_query_range("SELECT u.name FROM {users} u WHERE LOWER(u.name) LIKE LOWER('%s%%')", $string, 0, 10);
while ($user = db_fetch_object($result)) {
$matches[$user->name] = check_plain($user->name);
}
if (stripos(variable_get('anonymous', t('Anonymous')), $string) === 0) {
$matches[variable_get('anonymous', t('Anonymous'))] = variable_get('anonymous', t('Anonymous'));
}
if (module_exists('devel')) {
$GLOBALS['devel_shutdown'] = FALSE;
}
exit(drupal_json($matches));
}