In the administrator area of Joomla 3.6.x the User Manager has a number of filters to change the sorting of users. I always want the most recently registered users to appear on top without having to select that option (Registration Date). Is there a way to force the selection, perhaps with an override? Thanks.
Override the file
administrator/components/com_users/views/users/tmpl/default.php (e.g. copy it to
Change the following 2 lines:
$listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction'));
$listOrder = 'a.registerDate'; $listDirn = 'DESC';
Save the file, and then clear your Joomla cache.
Note: The above override will cause the ordering to be always by last registration date, even if you choose another ordering (in other words, the ordering will be hardcoded).
I know this is a fairly old question but it comes up in Google when searching for "Joomla default sort" and so I'd like to add a more definitive answer.
The default ordering for most of the Joomla backend manager pages (Menu manager, User manager, Article manager, Featured Article manager, Category manager, etc) are all part of Joomla core files that can't be modified via Joomla's template override functionality.
Ie, if you want to be able to modify the default ordering without losing the ability to change the sort order (the issue with itoctopus' answer) then you'll be forced to make core edits.
For each manager page the core edits are very similar. You need to modify two files:
I'll use the User manager as an example (since that's what this question is asking about specifically):
and find the "fullordering" field. Modify the "default" attribute from "a.name ASC" to "a.registerDate DESC" (or whatever you want the new default to be). This change will result in the drop-down select menu on the page to show that new value as the default when the page loads.
and find the populateState() method:
protected function populateState($ordering = 'a.name', $direction = 'asc')
Change those default parameter values to what you want:
protected function populateState($ordering = 'a.registerDate', $direction = 'desc')
This change is what results in the default ordering being different.
In the same way, if you wanted the "Featured Articles" manager to order by "Start Publishing" date by default you'd follow the same steps:
and change the "default" attribute of the "fullordering" field to "a.publish_up DESC"
and change the parameters of the populateState() method:
protected function populateState($ordering = 'a.publish_up', $direction = 'desc')
As always, since this is core edit any Joomla updates may undo these changes and so you'll have to check for this and re-apply the changes if needed.