[wp-trac] [WordPress Trac] #14569: Assign plugins on a per-site-basis
WordPress Trac
noreply at wordpress.org
Fri Oct 31 14:09:57 UTC 2014
#14569: Assign plugins on a per-site-basis
-----------------------------+-----------------------------
Reporter: ChantalC | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: multisite
-----------------------------+-----------------------------
Comment (by rufein):
Replying to [comment:12 earnjam]:
> This is something that has come up quite a bit for me, so I'd love to
work on writing a patch for this. But before I get too far into it, I
wanted to post a thought/question here.
>
> Right now, all plugins are available on all sites immediately upon
installation, so I would assume we'd like to keep that behavior going
forward for easy backwards compatibility and consistency. So should this
be set up opposite of the way themes work? Themes are stored as an array
of "allowedthemes" in {{{wp_sitemeta}}} and the individual
{{{wp_options}}} table for each site. But if the desire is for plugins to
be enabled by default, then should this be "disabledplugins" or something
similar?
>
> Would that be to confusing for themes and plugins to act differently
though? They act differently now, but that is primarily because plugins
don't have the enable/disable option. Perhaps they should be aligned for
consistency?
----
You are right. The behaviour is different. I want to make an explanation
about the different behaviour of themes and plugins:
== Themes ==
'''Network Enable''' => This option makes that a theme will be available
in the themes admin page of every site. The admin of every site can active
or deactivate the theme.
== Plugins ==
'''Network Activate''' => This option makes that a plugin will be active
in all sites. The admin of a site has no privileges to activate or
deactivate. In fact, the plugin won't be shown in the admin plugins list
of a site.
== Conclusion ==
So, you can add themes to the server. But it won't be visible until the
network admin enable the theme to the network. On the other hand, a
'''plugin always be visible'''. If the network admin activate the plugin,
it will available in every site. The sites admin can´t deactivate the
plugin, but they can configure and use it.
The request feature of this thread is about '''visibility'''. Instad of
`disabledplugins` meta option, i would call it `visibility_plugins`. This
change is to avoid confusion. A plugin could be disable, but visible to
give the chance to activate the plugin.
== A possible approach ==
I would build `visibility_plugins` in the following way:
{{{
array(
"plugin_name" => array(), // Always visible
"akismet" => array(1, 2, 5), // array of unique $blog_id sites that
will be invisible
"hello" => array(0), // Plugin -hello- will be invisible in all
sites.
);
}}}
We have to take into account:
* If a plugin is activated in network, the visibility of the whole module
have to be unset.
* If a plugin is active in some site, the $blog_id visibility have to be
unset.
And it could be neccesary build an admin configuration page with
checkboxes in the network admin area to configure the visibility of
plugins.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14569#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list