we would like to have the users sorted by last name in user lists, e.g. in the “add participant form”. I had a look at OMP 1.2 and the lists are still sorted by id.
So I added some code to “AddParticipantFormHandler.js”, but it’s just a hack (the last name variable is missing) that is restricted to the “add participant form” and of course we would prefer a proper PKP-solution in the OMP-code.
To do this in the database, edit lib/pkp/classes/user/UserStageAssignmentDAO.inc.php and find the getUsersNotAssignedToStageInUserGroup function. As you can see, there’s no ORDER BY clause in the SQL. You could add this to the end of the query:
ORDER BY u.last_name
To get it merged into mainline OMP, all it would take is a pull request
Thanks,
Alec Smecher
Public Knowledge Project Team
Serves me right for spending so much time writing PHP. Javascript arrays do not support ordering other than by the array index, so even if OJS serves up users in a different order, Javascript will dutifully rearrange them into ID order.
To resolve this, you’d need to serve up an array structure like this from PHP:
I just noticed that you have already implemented a solution for OJS 3.0. Could you also add it to OMP 1.2 ? We urgently need it since we have a lot of proofreaders to select from.
It looks like the relevant change is this pull request. I haven’t cherry-picked that into OMP 1.2.0, but I did perform a test-run of the cherry pick, and it appears to apply cleanly. I’d suggest seeing if that does the trick for you. Then cherry-pick this commit to make the sort occur by last name. (Both of these changes will be released with OMP 3.1, currently scheduled for March 1st. See the milestones page
for details.)
Regards,
Alec Smecher
Public Knowledge Project Team