Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12741 closed defect (bug) (fixed)

Plugin Editor Allows editing active plugins; Plugin listing doesnt list Edit for active plugins

Reported by: dd32's profile dd32 Owned by: jane's profile jane
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Plugins Keywords:
Focuses: Cc:

Description

The UI on the Plugin listing page does not Link to the plugin editor for active plugins.

The Plugin Editor supports editing active plugins (Both in the plugin dropdown selection, As well as including a deactivation/error-scrape/livepreview functionality to prevent the blog going down due to an edit).

This inconsistancy should probably be changed, Either:

  • Link to the plugin editor even for active plugins
  • Prevent the plugin editor from editing active plugins

I noticed this whilst working on #10925

Attachments (1)

12741.patch (1021 bytes) - added by TobiasBg 15 years ago.
Patch to restore "Edit" link for active plugins

Download all attachments as: .zip

Change History (17)

#1 @TobiasBg
15 years ago

Link to the plugin editor even for active plugins

Could be an idea, but I think the current situation is also fine. (No need to actively propagate the feature.)

Prevent the plugin editor from editing active plugins

No possibility, imo. If the admin wants to edit an active plugin, let him do it.

#2 follow-up: @dd32
15 years ago

No possibility, imo.

Quote agree, I was just pointing out the option :)

Could be an idea, but I think the current situation is also fine. (No need to actively propagate the feature.)

"If the admin wants to edit an active plugin, let him do it."

See, This is what i was coming up against, If someone -wants- to do it, let them, They're not going to break the install by doing so (Thanks to the fatal error handling code).

My initial reason for bringing this up was due to the mis-match of the actions on the Active vs. Inactve plugins in the list, I wanted to edit an active plugin, I could edit the inactive plugins either side of it, but not the active plugin in the middle.

#3 in reply to: ↑ 2 @TobiasBg
15 years ago

Hi,

My initial reason for bringing this up was due to the mis-match of the actions on the Active vs. Inactve plugins in the list, I wanted to edit an active plugin, I could edit the inactive plugins either side of it, but not the active plugin in the middle.

Yep, just changed my opinion :-) I was afraid a little that unexperienced users might do that, but then again they are the admin (and others won't see the link). And as they can't really break anything, yes, that link should be there. :-)

#4 @jane
15 years ago

I think the link should be there for anyone with editing privileges.

#5 @TobiasBg
15 years ago

  • Keywords has-patch added; needs-patch dev-feedback removed

Woops, just noticed that the absence of the link would actually be a regression. The "Edit" link is there for active and inactive plugins in WP < 3.0.

It got moved to inactive plugins only in this changeset: [12903]

Attached patch also shows it for active plugins.

A question that I could not answer, as I don't have MS test-install at the moment: Might additional checks for more than the "edit_plugins" cap necessary on MS installs, like checks for is_super_admin()? We don't want admins to edit plugins which are also active on other sites of the networks, right?! :-) This probably should also be checked for the drop down menu way of accessing the plugin editor.

@TobiasBg
15 years ago

Patch to restore "Edit" link for active plugins

#6 @nacin
15 years ago

There were a series of changesets related to the plugin links and network plugins. Most thinks that broke / regressed were fixed, guess this one wasn't noticed. (I doubt it was intentional.)

edit_plugins is all that is necessary to check. In map_meta_cap() we deny a good number of privileges to non-super admins, including that one.

#7 @dd32
15 years ago

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

(In [13874]) Restore Edit link for active plugins. Whitespace & if end markers. Also removed a non-needed bool check. Fixes #12741

#8 @TobiasBg
15 years ago

The "Edit" link is now after the "Delete" link for inactive plugins, which is differing from WP < 3.0 behavior, (which was the reason why I rather duplicated code in my patch instead of moving it after the if-else-statement.)

I'm not really having a problem with that, it's just that we are moving a potentially dangerous link to the middle (I know that there is a AYS after clicking it and people should be able to read, but after reading this article, I would say that this is not the best place.)

Opinions?

#9 @nacin
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Agree, delete should be at the end. We could probably use a trick to not duplicate code once, i.e.

$actions['edit'] = true;
...
if ( isset( $actions['edit'] ) )
   $actions['edit'] = ...

X-ref [12287] as an idea.

#10 @nacin
15 years ago

  • Keywords has-patch removed

Yeah, [12287] should work great here. Forgot it used array_filter().

We need an order:

Network Only (text only)
Network Activate
Activate
Network Deactivate / Deactivate (only one would show)
Edit
Delete

That look good?

#11 @dd32
15 years ago

Hm, I didnt notice that re-ordering of actions.

It might be better to just add it in the block like TobiasBg suggested..

#12 @dd32
15 years ago

Another option, given the small number of items here, Is to leave the if($is_active).. branch for Activation/Deactivation only, and change it to as such:

			} // end if $is_active

			if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
				$actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';

			if ( !$is_active && current_user_can('delete_plugins') )
				$actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
		} // end if $context

#13 @nacin
15 years ago

(In [13979]) Push the Delete link to the end for plugin actions. see #12741

#14 @nacin
15 years ago

The only outstanding question is whether the delete link should be red.

That incidentally happened when I keyed the delete link as 'delete', thus creating <span class="delete">, which in action links makes the link go red.

I keyed it as plugin_delete instead for now. Will need feedback from Jane on this, then we're all set.

#15 @dd32
15 years ago

  • Owner changed from westi to jane
  • Status changed from reopened to reviewing

The only outstanding question is whether the delete link should be red.

For reference, in 2.9 it was not.

For consistancy, all Delete links in WordPress should be red IMO.

#16 @nacin
15 years ago

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

(In [14159]) Make the 'Delete' action link for plugins red. fixes #12741, props jane.

Note: See TracTickets for help on using tickets.