[wp-hackers] WordPress Network and Plugin Availability

SWORD Studios info at swordstudios.net
Wed Feb 9 13:04:31 UTC 2011


This will work perfectly for me. I just need to protect site owners
from themselves.  They aren't the most technical people.

I'll implement this and see what I can do to activate a Plugin
afterwards and let you all know.

Thanks Mark!

Comments by Jesse Friedman
Spelling by iPad

On Feb 9, 2011, at 1:53 AM, Mark Jaquith <markjaquith at gmail.com> wrote:

> On Mon, Feb 7, 2011 at 5:05 PM, SWORD Studios <info at swordstudios.net> wrote:
>> Is there a way to give specific sites, options to specific plugins.  I don't
>> want all site owners to be able to activate all the plugins installed on the
>> server.  For example I want site A to be able to active plugins 1 and 2 and
>> for site B to be able to activate plugins 2 and 3 because maybe plugin 1 and
>> 3 don't work well together or for countless other reasons.
>
> You can use the all_plugins filter to remove it from the list.
>
> function cws_deny_akismet( $plugins ) {
>    if ( !is_super_admin() && isset( $plugins['akismet/akismet.php'] ) )
>        unset( $plugins['akismet/akismet.php'] );
>    return $plugins;
> }
>
> add_filter( 'all_plugins', 'cws_deny_akismet' );
>
> This doesn't actually deny them from activating it, but without it
> present in the UI they won't know the nonce required to activate it.
> So it seems effective, at first glance.
>
> And obviously, you can run logic so that the above code is run in a
> mu-plugins file and conditionally removes certain plugins from the
> list of available plugins, based on which site admin is being
> accessed.
>
> Can anyone find a flaw in this approach? Can you find another way to
> activate the plugin?
>
> --
> Mark Jaquith
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list