Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#15318 closed defect (bug) (fixed)

Can't add custom columns to the plugins admin page

Reported by: scribu Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Administration Keywords: needs-patch
Focuses: Cc:


The Plugins list table is different from all the rest, in the sense that it uses more than one row per item (simplified):

  <td>Plugin Name</td>

<tr class="second">
  <td>Activate | Delete</td>
  <td>Version 1.0 | By: someone</td>

<tr class="plugin-update-tr">
  <td class="plugin-update" colspan="3">There's an update available</td>

I assume this approach was chosen to make the action links stay at the bottom, when the description is larger.


  • plugins can't add custom columns
  • columns can't be hidden

Supposing these two problems were fixed, we'd still have to have a weird workaround for the colspan attribute in the update notification row.

I suggest we switch to a single row per item and use CSS to position the elements.

Attachments (7)

class-wp-plugins-list-table.16235.diff (3.6 KB) - added by edward mindreantre 5 years ago.
Selected checkbox fix, description tr td fixed.
class-wp-plugins-list-table.17732.diff (3.6 KB) - added by edward mindreantre 5 years ago.
common.dev.js.17732.diff (1.0 KB) - added by edward mindreantre 5 years ago.
list-table.dev.js-17732.diff (588 bytes) - added by edward mindreantre 5 years ago.
2010-11-13_1646.diff (5.2 KB) - added by edward mindreantre 5 years ago.
All patches in one file.
15318.ms.themes.patch (6.9 KB) - added by ocean90 5 years ago.
colspan_magic.patch (5.1 KB) - added by ocean90 5 years ago.

Download all attachments as: .zip

Change History (29)

comment:1 @ocean905 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.1
  • Version set to 3.1

At the moment we have the problem with the "Show on screen" and "Description" option, see screenshot: http://grab.by/7dY4

comment:2 @voyagerfan57615 years ago

  • Cc WordPress@… added

comment:3 @WraithKenny5 years ago

If someone's going to refactor class-wp-plugins-list-table.php maybe they could also add column sorting.

#14987 might be possible to implement at the same time.

comment:4 @WraithKenny5 years ago

Note: CSS positioning on table-cells doesn't work.

@edward mindreantre5 years ago

Selected checkbox fix, description tr td fixed.

comment:5 @edward mindreantre5 years ago

  • Cc edward@… added

Two things have been fixed:

  1. Accessability rules say that (1) each checkbox needs a label and (2) every label should be unique. I've whipped something up that fulfills both criteria.
  1. Lower down I've moved the description stuff around. It's all now just one tr per plugin and the description gets hidden when using that there "show on screen" checkbox. The more observant of y'all will notice that the select checkbox column becomes enormous when the description is hidden, so a line or two in the css should solve that problem if my solution is satisfactory.

comment:6 @ocean905 years ago

edward mindreantre, thx for the patch. 2 things:

Notice: Undefined variable: plugin_name in /wordpress/wp-admin/includes/class-wp-plugins-list-table.php on line 386

Also after a reload or using the navigation, only the title will be hidden again.

comment:7 @edward mindreantre5 years ago

Fixed: Description column is hidden when reloading
Fixed: Namn column width is set to auto in order for the checkbox column to not take up half the table.

That should do it. I have no idea why the checkbox and name columns want 50% each...

Anything else broken?

comment:8 @ocean905 years ago

Switching to a next site via AJAX page navi hides the title only again.

comment:9 @edward mindreantre5 years ago

I believe the new list-table.js will solve your problem.

Unfortunately it has to run the .hide column() routine thing when switching pages which makes it look sorta weird for a few milliseconds. I haven't found where it sets each column width to 50% per default.

I tried setting the cb-column width to max-width 40px or whatever but it doesn't listen. Not after running .hide() on that column. It seems as if .hide() makes the table recalculate column widths.

Can we has-patch this yet? :)

comment:10 @scribu5 years ago

  • Keywords has-patch added; needs-patch removed

I so hate it when I don't receive email notifications on tickets I've openened.

comment:11 @scribu5 years ago

Common practice is to have all modified files in a single patch.

@edward mindreantre5 years ago

All patches in one file.

comment:12 @scribu5 years ago

(In [16346]) Move network only status check out of foreach. See #15318

comment:13 @scribu5 years ago

(In [16347]) Introduce WP_Plugins_List_table:single_row(). See #15318

comment:14 @scribu5 years ago

(In [16348]) Add 'manage_plugin_custom_column' action and properly hide plugin columns. See #15318

comment:15 @scribu5 years ago

(In [16349]) Rename action to 'manage_plugins_custom_column' to be consistent with other screens. See #15318

comment:16 @scribu5 years ago

Initial commit was [16345]

comment:17 @scribu5 years ago

(In [16350]) Make custom plugin columns hideable. See #15318

comment:18 @scribu5 years ago

  • Keywords needs-patch added; has-patch removed

Only thing left is to figure out what to do with plugin-update-tr.

comment:19 follow-up: @scribu5 years ago

ocean90 pointed out that WP_MS_Themes_List_Table needs the same treatment.

@ocean905 years ago

comment:20 in reply to: ↑ 19 @ocean905 years ago

Replying to scribu:

ocean90 pointed out that WP_MS_Themes_List_Table needs the same treatment.

Done with 15318.ms.themes.patch.

comment:21 @scribu5 years ago

(In [16361]) Rework WP_MS_Themes_List_Table column display. Props ocean90. See #15318

@ocean905 years ago

comment:22 @scribu5 years ago

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

(In [16368]) Introduce WP_List_Table::get_column_count() and take care of update notice <tr>. Props ocean90 for initial patch. Fixes #15318

Note: See TracTickets for help on using tickets.