Make WordPress Core

Opened 11 years ago

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

Download all attachments as: .zip

Change History (29)

#1 @ocean90
11 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

#2 @voyagerfan5761
11 years ago

  • Cc WordPress@… added

#3 @WraithKenny
11 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.

#4 @WraithKenny
11 years ago

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

@edward mindreantre
11 years ago

Selected checkbox fix, description tr td fixed.

#5 @edward mindreantre
11 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.

#6 @ocean90
11 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.

#7 @edward mindreantre
11 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?

#8 @ocean90
11 years ago

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

#9 @edward mindreantre
11 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? :)

#10 @scribu
11 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.

#11 @scribu
11 years ago

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

@edward mindreantre
11 years ago

All patches in one file.

#12 @scribu
11 years ago

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

#13 @scribu
11 years ago

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

#14 @scribu
11 years ago

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

#15 @scribu
11 years ago

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

#16 @scribu
11 years ago

Initial commit was [16345]

#17 @scribu
11 years ago

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

#18 @scribu
11 years ago

  • Keywords needs-patch added; has-patch removed

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

#19 follow-up: @scribu
11 years ago

ocean90 pointed out that WP_MS_Themes_List_Table needs the same treatment.

#20 in reply to: ↑ 19 @ocean90
11 years ago

Replying to scribu:

ocean90 pointed out that WP_MS_Themes_List_Table needs the same treatment.

Done with 15318.ms.themes.patch.

#21 @scribu
11 years ago

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

#22 @scribu
11 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.