[wp-trac] [WordPress Trac] #51878: Multisite only plugins can be enabled on non-multisite installs

WordPress Trac noreply at wordpress.org
Thu Nov 26 12:31:27 UTC 2020


#51878: Multisite only plugins can be enabled on non-multisite installs
-----------------------------+-----------------------------
 Reporter:  mikeyhoward1977  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Plugins          |    Version:  5.5.3
 Severity:  normal           |   Keywords:  needs-patch
  Focuses:                   |
-----------------------------+-----------------------------
 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 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/class-wp-plugins-list-table.php#L778 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51878>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list