WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#32735 closed defect (bug) (fixed)

Correctly sort translated plugin names in plugin list table

Reported by: swissspidy Owned by: ocean90
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.2
Component: Plugins Keywords: has-patch needs-testing
Focuses: ui, administration Cc:
PR Number:

Description

Pretty all list tables in WordPress have some sortable columns, except for the plugins screen.

This is pretty annoying when you have lots of plugins, as there is no clear order. It gets worse when plugins localized names. Example:

http://i.imgur.com/tDuaGi6.png

Here, the User Switching plugin should clearly not be at the end.

Funnily, the plugin list table already supports the orderby and order parameters, just the UI is missing.

Attachments (4)

32735.diff (528 bytes) - added by swissspidy 4 years ago.
Make plugin list table sortable
32735.2.diff (533 bytes) - added by swissspidy 4 years ago.
Screenshot 2015-07-02 12.03.28.png (50.7 KB) - added by GaryJ 4 years ago.
Incorrect (case-sensitive) sorting
32375.diff (825 bytes) - added by GaryJ 4 years ago.

Download all attachments as: .zip

Change History (22)

@swissspidy
4 years ago

Make plugin list table sortable

#2 @swissspidy
4 years ago

Thanks for the hint. Per nacin's 4-year old comment:

Per discussion with PeteMall and Jane in IRC, since sorting and pagination on the plugins screen is stateless, we should remove sorting on the plugin name column. Sorting, then making any action, will cause you to lose the action, which is lame.

Maybe it's time to make it not stateless anymore and save it as a user setting? Or at least make the sortable columns filterable (empty by default?) so a plugin can implement sorting. For example, a plugin could allow sorting plugins by their activation date.

Also lame, is that unlike on other screens that might be sorted by something else by default, the screen is already sorted by name. So the most this can do anyway is sort by name descending. Or as I like to call it, scroll to the bottom and use your imagination.

The sorting is still not correct when you have translated plugin names. However, this can be solved by having sortable columns and a default order of ?orderby=name&order=asc. It's very annoying when you have lots of plugins and you need to find plugins somewhere on the page. And no, Cmd+F is not a solution.

#3 @afercia
4 years ago

Maybe not sortable but they should definitely be ordered by their translated name and here @swissspidy makes a very good point :)

#4 @nacin
4 years ago

It should be very easy to sort these by translated name. I don't see how adding sortable columns helps that otherwise.

@swissspidy
4 years ago

#5 @swissspidy
4 years ago

This second patch defaults to order by name, which fixes the behavior for translated plugin names. If we only implement this, I can live with it. Although sorting by description would be nice too (like with taxonomies)…

Totally forgot that I can use the "manage_{$this->screen->id}_sortable_columns" filter if I want to add an additional sortable column (e.g. activation date).

#6 @swissspidy
4 years ago

  • Keywords has-patch added
  • Summary changed from Make plugin list table sortable to Correctly sort translated plugin names in plugin list table

#7 @afercia
4 years ago

+1 for this :) It is an improvement for non-English users.

This ticket was mentioned in Slack in #core by swissspidy. View the logs.


4 years ago

#9 @ocean90
4 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 33010:

Plugins list table: Sort plugins by Name by default so translated plugin names get correctly sorted.

props swissspidy.
fixes #32735.

#10 @ocean90
4 years ago

  • Milestone changed from Awaiting Review to 4.3

This ticket was mentioned in Slack in #core by dd32. View the logs.


4 years ago

@GaryJ
4 years ago

Incorrect (case-sensitive) sorting

#12 @GaryJ
4 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

This doesn't seem to work correctly when lowercase / extra uppercase characters are present:

https://core.trac.wordpress.org/raw-attachment/ticket/32735/Screenshot%202015-07-02%2012.03.28.png

  • bbPress and iThemes come last.
  • WP... comes before WordPress.

Presumably the sorting callback needs to take account of this too.

#13 @SergeyBiryukov
4 years ago

  • Component changed from General to Plugins
  • Focuses administration added

@GaryJ
4 years ago

#14 @GaryJ
4 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

The _order_callback() function didn't seem to be being used elsewhere. I'm not sure if sortable plugin data could include non-string data (at least data that won't sort with strcasecmp() - if so, then the patch won't work.

#15 @kraftbj
4 years ago

@garyj's patch (32375) worked for me both asc and desc.

#16 @SergeyBiryukov
4 years ago

Sortable plugin data should only include strings, and 32375.diff looks good.

Should we do the same in WP_Plugin_Install_List_Table::order_callback() and WP_MS_Themes_List_Table::_order_callback(), for consistency?

This ticket was mentioned in Slack in #core by garyj. View the logs.


4 years ago

#18 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 33076:

Plugins list table: Use case-insensitive sorting.

props GaryJ.
fixes #32735.

Note: See TracTickets for help on using tickets.