XF 2.0 Members online in alphabetical order?

Tipmoose

Member
I found how to set this in XF 1.x, but I can't find how to set the Members Online Now widget in the sidebar to display members in alphabetical order. Can this be done easily?
 
What determines the order currently? In XF1 there was a php edit that could be made to the session class that would change the order. Where/how is the order being determined in XF2? Does anyone know?
It's the same. You'd just need to figure out where the query comes from. Pre-sorted by most recent activity.
 
I would be curious to know if this is possible without an add-on also.

It's the same. You'd just need to figure out where the query comes from. Pre-sorted by most recent activity.

Thanks, yolo.

I poked around and figured out how to do it.
1) Edit the src/XF/Repository/SessionActivity.php file.
2) Change line 36 and optionally 55 (if you want a sorted staff online box) to be ->order('User.username');
3) The relevant functions are getOnlineUsersList($limit) and getOnlineStaffList()

This will cause your file health check to complain about the SessionActivity.php file being modified. You will also lose these changes whenever you upgrade to another version of XF.
 
The downside of that edit is that people you follow will no longer appear by most recent view time at the top of the widget - if you care. Not sure what you'd edit where to prevent that.
 
Last edited:
Top Bottom