WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#16011 closed defect (bug) (fixed)

Editing a Network Activated plugin deactivates it

Reported by: Otto42 Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Plugins Keywords: has-patch needs-parentheses
Focuses: Cc:

Description

When you go to edit a plugin using the plugin editor, it comes back up as "(active)", however it will actually be deactivated.

Only spotted this with Network Activated plugins.

3.1 RC1.

Attachments (3)

16011.patch (662 bytes) - added by SergeyBiryukov 3 years ago.
16011.2.patch (697 bytes) - added by SergeyBiryukov 3 years ago.
16011.3.patch (701 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1

SergeyBiryukov3 years ago

comment:2 SergeyBiryukov3 years ago

  • Keywords has-patch added

Was able to reproduce with a plugin which was activated both for Network and specifically on the current site. is_plugin_active() was returning true, so plugin was not reactivated for Network.

I guess we can check is_plugin_active_for_network() too. Patch included.

Or perhaps deactivate_plugins() should always check active_plugins, even if $network_wide.

comment:3 nacin3 years ago

is_plugin_active() checks for is_plugin_active_for_network().

Instead, I imagine the check should probably be based on !empty($_GET['networkwide']). If true, check is_plugin_active_for_network. Otherwise, is_plugin_active.

comment:4 nacin3 years ago

  • Keywords needs-patch added; has-patch removed

SergeyBiryukov3 years ago

comment:5 SergeyBiryukov3 years ago

  • Keywords has-patch added; needs-patch removed

Revised the condition.

BTW, currently when I activate a plugin for Network, it disappears from wp-admin/plugins.php. Not sure how I've managed to get it activated in both places simultaneously.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

comment:6 follow-up: ryan3 years ago

Seems fine, but let's add some parens to make the order of operations clear.

comment:7 follow-ups: nacin3 years ago

  • Keywords needs-parentheses added

I imagine you were able to double-activate because it was active on the main site first, then you network activated it. (Network deactivating it will leave it active on the main site, as before.)

SergeyBiryukov3 years ago

comment:8 in reply to: ↑ 6 SergeyBiryukov3 years ago

Replying to ryan:

Seems fine, but let's add some parens to make the order of operations clear.

Done.

comment:9 in reply to: ↑ 7 SergeyBiryukov3 years ago

Replying to nacin:

I imagine you were able to double-activate because it was active on the main site first, then you network activated it. (Network deactivating it will leave it active on the main site, as before.)

When I network activate a plugin, it disappears from the list of active plugins on the main site, so I guess this means it is automatically deactivated there (or should be).

comment:10 in reply to: ↑ 7 SergeyBiryukov3 years ago

Replying to nacin:

(Network deactivating it will leave it active on the main site, as before.)

Missed this comment. It makes sense for me now.

comment:11 ryan3 years ago

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

(In [17183]) Don't deactivate a plugin that is both network activated and activated on the main site after editing. Props SergeyBiryukov. fixes #16011

Note: See TracTickets for help on using tickets.