function views_ajax_autocomplete_user

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 ajax.inc views_ajax_autocomplete_user($string = '')
cle7 ajax.inc views_ajax_autocomplete_user($string = '')
elmsmedia7 ajax.inc views_ajax_autocomplete_user($string = '')
icor7 ajax.inc views_ajax_autocomplete_user($string = '')
meedjum_blog7 ajax.inc views_ajax_autocomplete_user($string = '')
mooc7 ajax.inc views_ajax_autocomplete_user($string = '')

Page callback for views user autocomplete

Related topics

1 string reference to 'views_ajax_autocomplete_user'
views_menu in sites/all/modules/ulmus/views/views.module
Implement hook_menu().

File

sites/all/modules/ulmus/views/includes/ajax.inc, line 287
Handles the server side AJAX interactions of Views.

Code

function views_ajax_autocomplete_user($string = '') {
  // The user enters a comma-separated list of user name. We only autocomplete the last name.
  $array = drupal_explode_tags($string);

  // Fetch last name
  $last_string = trim(array_pop($array));
  $matches = array();
  if ($last_string != '') {
    $prefix = count($array) ? implode(', ', $array) . ', ' : '';

    if (strpos('anonymous', strtolower($last_string)) !== FALSE) {
      $matches[$prefix . 'Anonymous'] = 'Anonymous';
    }

    $result = db_select('users', 'u')->fields('u', array('uid', 'name'))->condition('u.name', db_like($last_string) . '%', 'LIKE')->range(0, 10)->execute()->fetchAllKeyed();

    foreach ($result as $account) {
      $n = $account;
      // Commas and quotes in terms are special cases, so encode 'em.
      if (strpos($account, ',') !== FALSE || strpos($account, '"') !== FALSE) {
        $n = '"' . str_replace('"', '""', $account) . '"';
      }
      $matches[$prefix . $n] = check_plain($account);
    }
  }

  drupal_json_output($matches);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.