Jump to content

Modifying the Admin Users List


Arcturus
 Share

Recommended Posts

I'm trying to do a pair of seemingly simple things, given how the rest of Processwire works, but can't figure them out.

1) I've added the fields "firstname" and "lastname" to the User template and would like to list those values along with Name, E-Mail Address and Roles in the Admin > Access > Users table. There's a built-in option to do this for the user list in the page tree view... but not the place where you'd be doing your user management. I looked through the admin files and couldn't find where this list was being generated.

2) I'd like to change the label for the system name field from "Name" to "Username" for clarity purposes.

Any suggestions?

Link to comment
Share on other sites

Arcturus,

Go to Modules > Process > Users. It should let you select what fields you want to be shown in the listing, and in what order.

As for changing the name of the "name", I don't think you can do that short of going through a hook or using the multi-language translation system (and translating the default language value). If you want to do that, the file where it is located is /wire/modules/Process/ProcessPageType/ProcessPageType.module in the renderList() method. Of course, you could just change it directly in that file, but your change would get overwritten during upgrades, so you'd need to remember to change it again. 

  • Like 1
Link to comment
Share on other sites

  • 8 years later...

@ryan Digging out a 9 year old topic:

A common use case for me would be to sort users by `created`, so newest users are displayed first. Unfortunately the column `created` can not be selected in the module settings, as it's a system field. Neither can the default order be specified in the module configuration. Would that be something to consider for future updates?

Link to comment
Share on other sites

55 minutes ago, MrSnoozles said:

Unfortunately the column `created` can not be selected in the module settings, as it's a system field.

Not sure why that is. Seems strange considering that system fields can be added by users in the Columns tab.

You can use a hook to set the columns and default sort:

$wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) {
	/* @var ProcessPageLister $lister */
	$lister = $event->object;
	// Only for Users lister
	if($lister->parent->id !== 29) return;
	// Include "created" in default columns
	$lister->columns = [
		'name',
		'email',
		'roles',
		'created',
	];
	// Set default sort
	$lister->defaultSort = '-created';
	// Optional: allow user to change sort but reset to default sort each time Access > Users is visited
	if(!$event->wire()->config->ajax) $lister->sessionSet('sort', '');
});

 

  • 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...