diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
index 98807c9a2d9b1db77a64a8f3c7305587111663b3..126bf8b70318086a96c679bfd468ae6e31927cce 100644
--- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
+++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php
@@ -138,17 +138,8 @@ class BackendUserController extends ActionController
         }
         $compareUserList = $this->moduleData->getCompareUserList();
 
-        // Create online user list for easy parsing
-        $onlineUsers = $this->backendUserSessionRepository->findAllActive();
-        $onlineBackendUsers = [];
-        if (is_array($onlineUsers)) {
-            foreach ($onlineUsers as $onlineUser) {
-                $onlineBackendUsers[$onlineUser['ses_userid']] = true;
-            }
-        }
-
         $this->view->assignMultiple([
-            'onlineBackendUsers' => $onlineBackendUsers,
+            'onlineBackendUsers' => $this->getOnlineBackendUsers(),
             'demand' => $demand,
             'backendUsers' => $this->backendUserRepository->findDemanded($demand),
             'backendUserGroups' => array_merge([''], $this->backendUserGroupRepository->findAll()->toArray()),
@@ -208,7 +199,8 @@ class BackendUserController extends ActionController
 
         $this->view->assignMultiple([
             'shortcutLabel' => 'compareUsers',
-            'compareUserList' => $compareData
+            'compareUserList' => $compareData,
+            'onlineBackendUsers' => $this->getOnlineBackendUsers()
         ]);
     }
 
@@ -346,4 +338,24 @@ class BackendUserController extends ActionController
         $loginType = $this->getBackendUserAuthentication()->getLoginType();
         return GeneralUtility::makeInstance(SessionManager::class)->getSessionBackend($loginType);
     }
+
+    /**
+     * Create an array with the uids of online users as the keys
+     * [
+     *   1 => true,
+     *   5 => true
+     * ]
+     * @return array
+     */
+    protected function getOnlineBackendUsers(): array
+    {
+        $onlineUsers = $this->backendUserSessionRepository->findAllActive();
+        $onlineBackendUsers = [];
+        if (is_array($onlineUsers)) {
+            foreach ($onlineUsers as $onlineUser) {
+                $onlineBackendUsers[$onlineUser['ses_userid']] = true;
+            }
+        }
+        return $onlineBackendUsers;
+    }
 }
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
index 047966345a4c03d1cecf84e86071c8416a988d96..934b0a3dd554d4920ace0f15c9005f3978f98699 100644
--- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
@@ -14,7 +14,7 @@
         <be:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
             <b>{backendUser.userName}</b>
         </be:link.editRecord>
-        <f:if condition="{bu:arrayElement(array: onlineBackendUsers, key: backendUser.uid)}">
+        <f:if condition="{onlineBackendUsers.{backendUser.uid}}">
             <span class="label label-success"><f:translate key="online" /></span>
         </f:if>
         <br />
diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
index 4cfc6fbd955d0412483eac902b43ed6b59297977..41b2241450ebca6c9f09ae53779d557aaff7cbb4 100644
--- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
+++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
@@ -57,16 +57,20 @@
                     <th><f:translate key="disable_compare" /></th>
                     <f:for each="{compareUserList}" as="compareUser">
                         <td>
-                            <f:if condition="{compareUser.disable}">
-                                <f:then>
-                                    <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=0', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.unhide')}">
-                                        <core:icon identifier="actions-edit-unhide" />
-                                    </a>
-                                </f:then>
+                            <f:if condition="{onlineBackendUsers.{compareUser.user.uid}}">
                                 <f:else>
-                                    <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=1', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.hide')}">
-                                        <core:icon identifier="actions-edit-hide" />
-                                    </a>
+                                    <f:if condition="{compareUser.user.disable}">
+                                        <f:then>
+                                            <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=0', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.unhide')}">
+                                                <core:icon identifier="actions-edit-unhide" />
+                                            </a>
+                                        </f:then>
+                                        <f:else>
+                                            <a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=1', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.hide')}">
+                                                <core:icon identifier="actions-edit-hide" />
+                                            </a>
+                                        </f:else>
+                                    </f:if>
                                 </f:else>
                             </f:if>
                         </td>