diff -u b/src/Form/AllOtherUsersLogoutForm.php b/src/Form/AllOtherUsersLogoutForm.php --- b/src/Form/AllOtherUsersLogoutForm.php +++ b/src/Form/AllOtherUsersLogoutForm.php @@ -4,8 +4,6 @@ use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\user\Entity\User; -use Drupal\user\Entity\Role; use Drupal\Core\Entity\EntityTypeManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -60,13 +58,6 @@ public function buildForm(array $form, FormStateInterface $form_state){ $config = $this->config('force_users_logout.allotherusers_logout_form'); $form = array(); - $roles = Role::loadMultiple(); - $optionarray[] = ''; - foreach ($roles as $rolekey => $roleval) { - if ($rolekey != 'administrator' && $rolekey != 'authenticated' && $rolekey != 'anonymous') { - $optionsarray[$rolekey] = $roleval->label(); - } - } $form['input_fields']['selectallogout'] = [ '#type' => 'checkbox', '#title' => $this->t('This setting will force logout all users except admin'), @@ -93,7 +84,6 @@ ->condition('roles','anonymous','<>'); $uids = $query->execute(); $result = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple($uids); - /** @var \Drupal\user\UserInterface $user */ foreach ($result as $user) { \Drupal::currentUser()->setAccount($user); if (\Drupal::currentUser()->isAuthenticated()) {