Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#15372 closed feature request (wontfix)

Add new plugin header parameter BlogOnly

Reported by: raido357 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Plugins Keywords: has-patch
Focuses: Cc:



I had a need to disable network activation for certain plugin.

There's "Network" parameter in plugin header but only make plugin network only or not. I need just the opposite, so i hacked a bit and come up with following.

I added new parameter "BlogOnly" -- don't know if it's the best word but it works.

If BlogOnly is set to "true" in plugin header, then Network activation link is not shown. Idea come from the issue with network activation in WP 3.0.1 - where activation_hooks don't fire on every blog. Yes, I am aware that there's trac ticket for this and in 3.1 probably will be fixed, but still there should be this BlogOnly option in my opinion.

I've included patches.

Maybe this could be included in WP 3.1 release ?

Attachments (2)

wp_admin_plugins.patch (1.1 KB) - added by raido357 5 years ago.
wp-admin/plugins.php patch
wp_admin_includes_plugin.patch (2.4 KB) - added by raido357 5 years ago.
wp-admin/includes/plugin.php patch

Download all attachments as: .zip

Change History (8)

5 years ago

wp-admin/plugins.php patch

5 years ago

wp-admin/includes/plugin.php patch

#1 @raido357
5 years ago

  • Keywords has-patch added; plugin disable network activation blog only removed

#2 @scribu
5 years ago

Can you give an example of a plugin that would need this?

#3 @raido357
5 years ago

I have plugin which uses some extra database tables which have to be created, when plugin is activated. But via network activation plugin is activated but action "activate_myplugin" doesn't trigger, so no db tables are created and plugin is broken.

Same goes with deactivation.

For activation i could use workaround by adding admin_head action and call installation function there but for deactivating i can't call uninstallation that way.

So to keep people with no clue out of headache, I would simply disable network activation.

I understand if this is really not needed, i'll just have to add huge warning to plugin installation how to, do not use network activation.

Of course one could say that plugin structure and logic is wrong and approaching from different angle could avoid this network activation issue, but I am not the first one to work on this plugin, there have been other developers and I am really don't want to rewrite most of the plugin.

This plugin is not available yet in WP plugins repository.

#4 @westi
5 years ago

I'm not sure we really need this.

It is highly unlikely that anyone is going to run your plugin on a large network if it creates tables.

I think you would do better to improve the plugin instead.

#5 @scribu
5 years ago

I don't think we should add a header just because network activation isn't handled properly at the moment.

Any other example?

#6 @nacin
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Severity changed from major to normal
  • Status changed from new to closed

Any variation of this will do:

register_activation_hook( __FILE__, 'my_activation_callback' );
function my_activation_callback() {
    if ( is_multisite() )
} );
Note: See TracTickets for help on using tickets.