I would like to add another field for sorting users in User Manager. I can't find in google what I need to edit (what files to edit, where fields should be created). I am new to Joomla, so I don't know if there are hooks available, I don't want to edit core files. I have a custom field for the sorting already, it is named Company name (Название огранизации). I need to sort users according to this value. How can I achieve that?

user manager pic

enter image description here


To start with you can create a override of the list page, your first image, by going into the Administrator Template you are using on your site, by default the drop down will display Site so you need to change it to Administrator. Select the Administrator

Select the Tab Create Override and then going to com_users at the bottom of the Components list, expanding the selection and select the last file, users. Admin Template override

Then select the Editor Tab and make your way to the file you just created. Edit your override file

That is the relative easy bit, you have got a copy of the core file that you can edit and make your changes that wont be lost during upgrades etc. You can find out more about Overrides by reading the Joomla Docs or the may tutorials people have written to understand overrides in templates.

The more difficult piece of your requirement is getting the custom field value to place in the column of the display.

When you create a custom field for a component, in your case the com_user component, the field and its value are not stored in the components database tables but in the tables of the com_field component. You can see the tables #__fields_fields, #__fields_values, #__fields_group, #__fields_etc. When you see the custom fields displayed in a components output, there is separate processing that has occurred to retrieve the values of the custom field.

Because you can't override the Model or View for com_user that gets the data for the page you will need to add your own code in the override file you have created above that retrieves the value for the company custom field and display it in a new column. I expect you will need to read up on how to retrieve the custom field(s) but to point you in the right direction it will probably contain something like this;

$user           = Factory::getUser();
$customFields   = FieldsHelper::getFields('com_users.user', $user, true);
  • Thanks a lot! I will mark your answer as right but I need to research how to retrieve custom field value to add this info to your answer. Jun 26 at 11:27
  • @high sorry but I didn't see any value in your suggested edit on this answer. Telling researchers to rename the default.php file as default.php seems nonsensical to me. Feel free to comment to Irata if you wish for him to improve this answer.
    – mickmackusa
    Jun 29 at 20:58
  • 1
    @mickmackusa that's the obstacle I didn't know about, I thought automatically created override file should actually override standard default.php file but that didn't work for me. I had default2021-06-26-091595.php that worked after I had renamed it. Jul 16 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.