function user_search_execute

cis7 user.module user_search_execute($keys = NULL, $conditions = NULL)
cle7 user.module user_search_execute($keys = NULL, $conditions = NULL)
elmsmedia7 user.module user_search_execute($keys = NULL, $conditions = NULL)
icor7 user.module user_search_execute($keys = NULL, $conditions = NULL)
meedjum_blog7 user.module user_search_execute($keys = NULL, $conditions = NULL)
mooc7 user.module user_search_execute($keys = NULL, $conditions = NULL)

Implements hook_search_execute().

File

modules/user/user.module, line 933
Enables the user registration and login system.

Code

function user_search_execute($keys = NULL, $conditions = NULL) {
  $find = array();
  // Replace wildcards with MySQL/PostgreSQL wildcards.
  $keys = preg_replace('!\*+!', '%', $keys);
  $query = db_select('users')->extend('PagerDefault');
  $query->fields('users', array('uid'));
  if (user_access('administer users')) {
    // Administrators can also search in the otherwise private email field,
    // and they don't need to be restricted to only active users.
    $query->fields('users', array('mail'));
    $query->condition(db_or()->condition('name', '%' . db_like($keys) . '%', 'LIKE')->condition('mail', '%' . db_like($keys) . '%', 'LIKE'));
  }
  else {
    // Regular users can only search via usernames, and we do not show them
    // blocked accounts.
    $query->condition('name', '%' . db_like($keys) . '%', 'LIKE')->condition('status', 1);
  }
  $uids = $query->limit(15)->execute()->fetchCol();
  $accounts = user_load_multiple($uids);

  $results = array();
  foreach ($accounts as $account) {
    $result = array(
      'title' => format_username($account),
      'link' => url('user/' . $account->uid, array('absolute' => TRUE)),
    );
    if (user_access('administer users')) {
      $result['title'] .= ' (' . $account->mail . ')';
    }
    $results[] = $result;
  }

  return $results;
}
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.