WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#51878 closed defect (bug) (invalid)

Multisite only plugins can be enabled on non-multisite installs

Reported by: 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.


10 months ago

  • 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
10 months ago

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

Incorrect interpretation of Network: true header

#3 @prbot
10 months ago

TimothyBJacobs commented on PR #769:

Closing PR as the ticket has been closed.

#4 @peterwilsoncc
10 months ago

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