You are here

function uc_coupon_autocomplete_user in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.admin.inc \uc_coupon_autocomplete_user()
  2. 7.3 uc_coupon.admin.inc \uc_coupon_autocomplete_user()
  3. 7.2 uc_coupon.admin.inc \uc_coupon_autocomplete_user()
1 string reference to 'uc_coupon_autocomplete_user'
uc_coupon_menu in ./uc_coupon.module
Implementation of hook_menu().

File

./uc_coupon.module, line 581
Provides discount coupons for Ubercart.

Code

function uc_coupon_autocomplete_user($string) {
  $matches = array();
  $anonymous = t('anonymous users');
  if (strpos($anonymous, $string) !== FALSE) {
    $matches[$anonymous . ' [uid:0]'] = $anonymous;
  }
  $result = db_query_range("SELECT uid, name FROM {users} WHERE name LIKE '%%%s%'", $string, 0, 10);
  while ($row = db_fetch_object($result)) {
    $matches[$row->name . ' [uid:' . $row->uid . ']'] = $row->name;
  }
  print drupal_to_js($matches);
  exit;
}