Pending

User tests: Successful: Unsuccessful:

avatar samuelagus
samuelagus
8 Sep 2025

Pull Request for Issue #46033

Summary of Changes

Edit this file administrator/modules/mod_logged/src/Helper/LoggedHelper.php
Add this code: ->order('s.time DESC') on line 50 to sort the list of Module Logged In Users in descending order by datetime.

Testing Instructions

Create an Admin Module: Logged-in Users
Users to Display: 10 (for example)
Name: Name or Username
Position: select the desired position
Status: Published
Then SAVE the Module.

Actual result BEFORE applying this Pull Request

See the result in the position you choose.
The list in the module table is not sorted properly.

Expected result AFTER applying this Pull Request

The list in the module table should be sorted by datetime in descending order.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar samuelagus samuelagus - open - 8 Sep 2025
avatar samuelagus samuelagus - change - 8 Sep 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Sep 2025
Category Modules Administration
avatar samuelagus samuelagus - edited - 8 Sep 2025
avatar samuelagus samuelagus - edited - 8 Sep 2025
avatar samuelagus samuelagus - change - 8 Sep 2025
The description was changed
avatar samuelagus samuelagus - edited - 8 Sep 2025
avatar samuelagus samuelagus - change - 8 Sep 2025
The description was changed
avatar samuelagus samuelagus - edited - 8 Sep 2025
avatar alikon alikon - test_item - 8 Sep 2025 - Tested successfully
avatar alikon
alikon - comment - 8 Sep 2025

I have tested this item ✅ successfully on 79b0551


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46047.

avatar richard67
richard67 - comment - 8 Sep 2025

New features have to be made for 6.1-dev.

avatar exlemor
exlemor - comment - 8 Sep 2025

I seem to be getting odd results after applying the Patch:

Safari 18.6 - Super User
in Safari-18 6

Vivaldi 7.5.3735.66 - Administrator
Vivaldi 7 5 3735 66

Google 140.0.7339.81 - Administrator
Google  140 0 7339 81

Notice how the order is NOT the same between the 3 browsers?!

@samuelagus any reason for this?

@alikon - which browser did you test with and did you test with more than 1?

avatar brianteeman
brianteeman - comment - 8 Sep 2025

@exlemor it is sorting by time and all three have the same time

avatar exlemor
exlemor - comment - 8 Sep 2025

Perhaps a stupid concept - time is NOT just 19:38 from a computer point of view right? (seconds are hidden, right i.e. 19:38:01 etc and all three have different time stamps (i.e. I switched browsers for each login so they have 2-10 seconds difference between them - so they should be all showing in the same order)? (or is Joomla truly cutting off time at 2 decimals? and therefore it's normal that each browser handles the order differently...

EITHER way, this is BEFORE the patch:

before PATCH

with the PR patch:

ScreenFloat Shot of Safari on 2025-09-09 at 00-27-38

I thought the BEFORE and AFTER were supposed to be different (sorry if I misunderstood). Thanks.

avatar samuelagus
samuelagus - comment - 9 Sep 2025

@samuelagus any reason for this?

This is the sample screenshot of session table in PhpMyAdmin:
session

Is it possible that the default ordering of the table is by first column, in this case is session_id column, so it will sorted by first character 0, 2, 7, c, i, ... ?

I thought the BEFORE and AFTER were supposed to be different (sorry if I misunderstood). Thanks.

Perhaps coincidentally in @exlemor 's case the session_id column is in the same order as the time column.
So the module table list appears to be in order of time even though the patch hasn't been applied yet.
I've try it using Chrome and Mozilla, they have the same correct result (descending order by time column).

Perhaps a stupid concept - time is NOT just 19:38 from a computer point of view right? (seconds are hidden, right i.e. 19:38:01 etc and all three have different time stamps (i.e. I switched browsers for each login so they have 2-10 seconds difference between them - so they should be all showing in the same order)? (or is Joomla truly cutting off time at 2 decimals? and therefore it's normal that each browser handles the order differently...

I see in: administrator/modules/mod_logged/tmpl/default.php line 58-60:

<td>
      <?php echo HTMLHelper::_('date', $user->time, Text::_('DATE_FORMAT_LC5')); ?>
</td>

So the Date column using the date format DATE_FORMAT_LC5, it means that the datetime will hide the second: Y-m-d H:i
If we change it to DATE_FORMAT_LC6 the datetime will be show the second: Y-m-d H:i:s
Do we need to change the date format to DATE_FORMAT_LC6 at this point? :)

@exlemor If you don't mind, would you mind adding more login sessions to test it again?
Thank you for your time and patience.

avatar exlemor
exlemor - comment - 10 Sep 2025

@samuelagus - I have added 2 more users (5 users on 5 different browsers) and same result :/

avatar samuelagus
samuelagus - comment - 10 Sep 2025

@samuelagus - I have added 2 more users (5 users on 5 different browsers) and same result :/

Thanks for your time to try it again.
Are the same results you mean referring to this:

#46047 (comment)
after patching, you get different order results when using Safari, Vivaldi, and Google browsers ?

or this :

#46047 (comment)
before and after patching, you get the same order results ? The results should be different between before patching and after patching.

avatar samuelagus
samuelagus - comment - 10 Sep 2025

I'm noticing some strange behavior in the Logged In Users module.
Every time I reload the page, the time displayed in the module automatically updates to the current time, especially in my username row.
The time will always change to the current time every time the user reloads the page or browse to another page.

I suspect this is the cause of the problems experienced by @exlemor

avatar richard67
richard67 - comment - 10 Sep 2025

I would assume that’s expected behavior when it is the time of the last activity and not the last login.

avatar brianteeman
brianteeman - comment - 10 Sep 2025

You need to check when the time is updated for a session

avatar samuelagus
samuelagus - comment - 10 Sep 2025

I would assume that’s expected behavior when it is the time of the last activity and not the last login.

Sorry for my misunderstanding. I thought that Last x Logged-in Users module displays a list of users who have recently logged in (entered through the login form and successfully logged into the website) as describe in module's description: This module shows a list of the Logged-in Users.

You need to check when the time is updated for a session

Sorry I may have misunderstood the title and description of this module.
The time updated everytime the user reload the page or browse to another page

avatar samuelagus
samuelagus - comment - 11 Sep 2025

@exlemor #46047 (comment)

Notice how the order is NOT the same between the 3 browsers?!
@samuelagus any reason for this?

Based on @richard67 comment: #46047 (comment)

I would assume that’s expected behavior when it is the time of the last activity and not the last login.

So I suspect the difference in the order of the list in the three browsers is due to the difference in the seconds between logins or page reload in each browser.
The most recent user who log in or reload the page will appear at the top of the list in the module in his/her own browser.
For example: When Felicia log in or reload the page, she will see her name appear at the top of the Logged-in Users module in her browser.
This behavior will also be experienced by other users when they login or reload the page in their own browser.

This behavior doesn't just occur across different browser brands.
Even if each user uses the same Chrome browser, they will experience this behavior.

This is because every time a user login or reloads the page, new session_id will be created.
So, this patch will sort the session db table based on the time column in descending order, so the list in the Logged-in Users module will also be sorted by datetime in descending order.

avatar ceford ceford - test_item - 17 Sep 2025 - Tested unsuccessfully
avatar ceford
ceford - comment - 17 Sep 2025

I have tested this item 🔴 unsuccessfully on 79b0551

With the patch applied I am getting an error.

I note that the applied patch shows code different from that in the patch diff. Specifically line 42:
public function getUsers(Registry $params, CMSApplication $app, DatabaseInterface $db): mixed
is shown as
public static function getList(Registry $params, CMSApplication $app, DatabaseInterface $db)
And I think getList was removed in another PR

So the error in my Home Dashboard:

An error has occurred.
0 Cannot instantiate abstract class Joomla\Module\Logged\Administrator\Helper\LoggedHelper
Call Stack
#	Function	Location
1	()	JROOT/libraries/src/Helper/HelperFactory.php:67
2	Joomla\CMS\Helper\HelperFactory->getHelper()	JROOT/administrator/modules/mod_logged/src/Dispatcher/Dispatcher.php:89
3	Joomla\Module\Logged\Administrator\Dispatcher\Dispatcher->getLayoutData()	JROOT/administrator/modules/mod_logged/src/Dispatcher/Dispatcher.php:44
4	Joomla\Module\Logged\Administrator\Dispatcher\Dispatcher->dispatch()	JROOT/libraries/src/Helper/ModuleHelper.php:289
5	Joomla\CMS\Helper\ModuleHelper::renderRawModule()	JROOT/libraries/src/Helper/ModuleHelper.php:160
6	Joomla\CMS\Helper\ModuleHelper::renderModule()	JROOT/administrator/components/com_cpanel/tmpl/cpanel/default.php:57
7	include()	JROOT/libraries/src/MVC/View/HtmlView.php:416
8	Joomla\CMS\MVC\View\HtmlView->loadTemplate()	JROOT/libraries/src/MVC/View/HtmlView.php:204
9	Joomla\CMS\MVC\View\HtmlView->display()	JROOT/administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php:157
10	Joomla\Component\Cpanel\Administrator\View\Cpanel\HtmlView->display()	JROOT/libraries/src/MVC/Controller/BaseController.php:697
11	Joomla\CMS\MVC\Controller\BaseController->display()	JROOT/administrator/components/com_cpanel/src/Controller/DisplayController.php:57
12	Joomla\Component\Cpanel\Administrator\Controller\DisplayController->display()	JROOT/libraries/src/MVC/Controller/BaseController.php:730
13	Joomla\CMS\MVC\Controller\BaseController->execute()	JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
14	Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()	JROOT/libraries/src/Component/ComponentHelper.php:361
15	Joomla\CMS\Component\ComponentHelper::renderComponent()	JROOT/libraries/src/Application/AdministratorApplication.php:150
16	Joomla\CMS\Application\AdministratorApplication->dispatch()	JROOT/libraries/src/Application/AdministratorApplication.php:205
17	Joomla\CMS\Application\AdministratorApplication->doExecute()	JROOT/libraries/src/Application/CMSApplication.php:304
18	Joomla\CMS\Application\CMSApplication->execute()	JROOT/administrator/includes/app.php:58
19	require_once()	JROOT/administrator/index.php:32

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46047.

Add a Comment

Login with GitHub to post a comment