Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#10421 closed enhancement (wontfix)

Unique ID on installed plugins

Reported by: williamsba1 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch
Focuses: Cc:


Currently all plugins listed on the Installed Plugins SubPanel have an active or inactive class. Would be nice for each to also have a unique ID, which could be generated from the plugin name

example: <tr class="active" id="akismet">

This would allow custom designs on individual plugins listed.

Attachments (1)

plugins.diff (612 bytes) - added by williamsba1 12 years ago.
added to $class variable to include plugin name to class

Download all attachments as: .zip

Change History (13)

#1 @Denis-de-Bernardy
12 years ago

suggesting we use a class instead:

class='$class' id='{$plugin_data['Name']}'

should be:

class='$class plugin-{$plugin_data['Name']}'

#2 @Denis-de-Bernardy
12 years ago

Or better yet, something that passes through sanitize_classname(). But definitely a class, not an ID. We can't know if/when we'll have plugins listed twice on the same screen.

#3 @Denis-de-Bernardy
12 years ago

  • Milestone changed from Unassigned to 2.9

#4 @williamsba1
12 years ago

  • Keywords has-patch added

I updated the patch file to include the plugin name in the class as your example shows.

#5 @Denis-de-Bernardy
12 years ago

  • Keywords needs-patch added; has-patch removed

there's a slight typo:

<tr class='$class plugin-{$plugin_data['Name']}' second> 

should at least be:

<tr class='$class plugin-{$plugin_data['Name']} second'> 

and probably:

<tr class='$class " . sanitize_html_class('plugin-' . $plugin_data['Name'], '') . " second'> 

or even this a bit further up:

$class .= ' ' . sanitize_html_class('plugin-' . $plugin_data['Name'], '');

12 years ago

added to $class variable to include plugin name to class

#6 @williamsba1
12 years ago

  • Keywords has-patch added; needs-patch removed

updated patch to add to $class variable to include plugin name

#7 @Denis-de-Bernardy
12 years ago

Cool. So, quick question... Is this behavior the behavior we're wanting (now you're seeing why I so preferred the class to the ID):

	<tr class='inactive plugin-Akismet'>
...	</tr>
	<tr class='inactive plugin-Akismet second'>
...	</tr>

To me, it makes sense, based on your stated goals, i.e. style a particular plugin in the admin area.

#8 @williamsba1
12 years ago

This works perfect for the intended goal. Just needed a way to style individual plugins listed and this update accomplishes just that!

#9 @azaozz
12 years ago

The last patch looks good but why is this needed? A plugin would be able to add the required css only while active or perhaps one plugin could highlight another? Or plugins can be hidden with js or css? Not sure if that's a good idea.

#10 follow-up: @williamsba1
12 years ago

I'm not sure how you would style individual plugins listed without some sort of unique identifier in either the class or by adding an ID?

#11 @TobiasBg
12 years ago

I, too, would not want a plugin to mess with the "Plugin List"! This is just not good, because it will confuse people and it will encourage more and more plugin authors to do the same, which will result in a very "colorful" Plugin List...

But, if you really need it, you could do it with jQuery, so no need for a CSS ID.
Have a look at the find ":contains()" selector.
You could add a class to your plugin's row with something like this:

$("tr:contains('Plugin Name')").addClass('special-plugin-row');

#12 in reply to: ↑ 10 @azaozz
12 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to williamsba1:

I'm not sure how you would style individual plugins listed without some sort of..

It's not how, it's why would you want to do this.

Note: See TracTickets for help on using tickets.