Jump to content

Sort /access/users by actual date by default?


modifiedcontent
 Share

Recommended Posts

Very minor wishlist request/question: When I go to /access/users I always have to manually add the column with Created or Modified to be able to sort by date and get the latest activity. I would like to have that as the default; get the latest users access data and not with 'two months ago' but actual dates. 

Or is there a way to configure that?

Link to comment
Share on other sites

It's not configurable, since the module config doesn't show system fields, but you can add them permanently with this little snipped for site/ready.php:

<?php namespace ProcessWire;

wire()->addHookBefore('ProcessUser::execute', function(HookEvent $event) {

	$process = $event->object;
	
	$process->showFields = array_merge($process->showFields, ["created", "modified"]);
	
});

For changing the date format to something more precise, you can hook into the lister:

<?php namespace ProcessWire;

wire()->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) {

    $page = wire('page');
    // Only continue if we're actually listing users in the backend
	if($page->process !== 'ProcessUser')
		return;
	
    $lister = $event->object;
    // Assign whatever date format you like
    $lister->nativeDateFormat = 'Y-m-d H:i';
});

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...