Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51878 closed defect (bug) (invalid)

Multisite only plugins can be enabled on non-multisite installs

Reported by: mikeyhoward1977's profile mikeyhoward1977 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.5.3
Component: Plugins Keywords: has-patch close
Focuses: Cc:

Description

If a plugin that contains the Network: true header is installed on a non multisite instance it is still possible to activate that plugin.

Shouldn't the behaviour be the same as when the plugin is installed in multisite, whereby you cannot activate the plugin from within individual sites and the message is displayed "Network Only"?

Line 778 of class-wp-plugins-list-table.php defines whether or not a plugin is a network only plugin by calling is_network_only_plugin() but it also checks for is_multisite() which means that the result is false and the plugin can be activated if it is not a multisite install.

Plugin devs can add code to perform their own checks and display notices etc. should this happen but it would make more sense for the user to not be able to activate these plugins in the first instance.

I propose to remove the call to is_multisite() when defining $restrict_network_only which will ensure that network only plugins can only be activated network wide and only within a multisite environment.

Change History (4)

This ticket was mentioned in PR #769 on WordPress/wordpress-develop by mikeyhoward1977.


4 years ago
#1

  • Keywords has-patch added; needs-patch removed

Plugins that have the Network: true header defined but should not be able to be activated on non-multisite installs.

Removing the check to is_multisite() when defining $restrict_network_only to achieve this.

Fixes: https://core.trac.wordpress.org/ticket/51878

#2 @mikeyhoward1977
4 years ago

  • Keywords close added
  • Resolution set to invalid
  • Status changed from new to closed

Incorrect interpretation of Network: true header

TimothyBJacobs commented on PR #769:


4 years ago
#3

Closing PR as the ticket has been closed.

#4 @peterwilsoncc
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.