function masquerade_autocomplete_user in Masquerade 6
Replacement function for user_autocomplete which allows the use of a comma separated list of user names.
1 string reference to 'masquerade_autocomplete_user'
- masquerade_menu in ./
masquerade.module - Implementation of hook_menu().
File
- ./
masquerade.module, line 631 - masquerade.module
Code
function masquerade_autocomplete_user($string) {
$array = drupal_explode_tags($string);
$search = trim(array_pop($array));
$matches = array();
if ($search) {
$prefix = count($array) ? implode(', ', $array) . ', ' : '';
$result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $search, 0, 10);
while ($user = db_fetch_object($result)) {
$matches[$prefix . $user->name] = check_plain($user->name);
}
}
drupal_json($matches);
}