You are here

function uc_coupon_autocomplete_role in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 5 uc_coupon.module \uc_coupon_autocomplete_role()
  2. 6 uc_coupon.admin.inc \uc_coupon_autocomplete_role()
  3. 7.2 uc_coupon.admin.inc \uc_coupon_autocomplete_role()

Autocomplete callback for role restrictions.

1 string reference to 'uc_coupon_autocomplete_role'
uc_coupon_menu in ./uc_coupon.module
Implements hook_menu().

File

./uc_coupon.admin.inc, line 833
Discount Coupons administration pages.

Code

function uc_coupon_autocomplete_role($string) {
  $matches = array();
  $result = db_query("SELECT name FROM {role} WHERE name LIKE :name", array(
    ':name' => "%{$string}%",
  ));
  foreach ($result as $row) {
    $matches[$row->name] = $row->name;
  }
  print drupal_json_encode($matches);
  exit;
}