I have a plugin that is creating a custom field. I am using the modifyUserSortableAttributes method to make my field appear in the columns available for the Users Table and wanted to be able to sort and filter by this column. The field values is stored as a simple alphanumeric string.

More on hook/method at https://craftcms.com/docs/plugins/hooks-reference#modifyUserSortableAttributes

Call in plugin code is:

public function defineAdditionalUserTableAttributes()
    return array(
        'institution' => "Institution"

public function modifyUserSortableAttributes(&$attributes)
    $attributes['institution'] = Craft::t('Institution');

However, when I use this method whilst I can add the requisite column to my User table in the admin area and sort the fields alphabetically in ascending order I cannot sort the table by descending order. No errors turning up in the console or site logs. Any suggestions on resolving or debugging greatly appreciated.



1 Answer 1


The underlying issue you're running into is this, which is an issue on both Craft 2 and 3 currently: https://github.com/craftcms/cms/issues/859

Can't think of a clean way to work around it, either.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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