Commit 5600df49 authored by alexpott's avatar alexpott
Browse files

Issue #2037675 by legolasbo: Clean-up user_admin_account().

parent 91bd01a8
...@@ -28,22 +28,19 @@ function user_admin_account() { ...@@ -28,22 +28,19 @@ function user_admin_account() {
->extend('Drupal\Core\Database\Query\PagerSelectExtender') ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
->extend('Drupal\Core\Database\Query\TableSortExtender'); ->extend('Drupal\Core\Database\Query\TableSortExtender');
$query $query
->fields('u', array('uid', 'name', 'status', 'created', 'access')) ->fields('u', array('uid'))
->limit(50) ->limit(50)
->orderByHeader($header) ->orderByHeader($header)
->setCountQuery($count_query); ->setCountQuery($count_query);
$result = $query->execute(); $uids = $query->execute()
->fetchCol('uid');
$destination = drupal_get_destination(); $destination = drupal_get_destination();
$roles = array_map('check_plain', user_role_names(TRUE)); $accounts = user_load_multiple($uids);
$accounts = array();
foreach ($result as $account) { foreach ($accounts as $account) {
$account = user_load($account->uid); $users_roles = $account->getRoles();
$users_roles = array(); unset($users_roles[0]);
$roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->id()));
foreach ($roles_result as $user_role) {
$users_roles[] = $roles[$user_role->rid];
}
asort($users_roles); asort($users_roles);
$username = array( $username = array(
'#theme' => 'username', '#theme' => 'username',
...@@ -78,8 +75,6 @@ function user_admin_account() { ...@@ -78,8 +75,6 @@ function user_admin_account() {
'#links' => $links, '#links' => $links,
); );
$options[$account->id()]['title']['data']['#title'] = check_plain($account->getUsername());
} }
$form['accounts'] = array( $form['accounts'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment