WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 4 months ago

Last modified 4 months ago

#42511 closed feature request (duplicate)

register_activation_hook with MultiSite

Reported by: tazotodua Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: multisite Cc:

Description

I think, it will be good, if any parameter/method will be added with that function, like:

register_activation_hook(__file__ ,'myFunc',  $FORCE_MULTISITE_BLOGS = true);

where the third parameter will indicate, if the activation happens in Network (multisite) dashboard, then the plugin should be activated for each sub-blog.

There is one problem:

define('variable_XYZ', home_url() );
function myFunc(){
    update_option('smth', variable_XYZ );
}

so, if just "myFunc" will be executed in the loop for each sub-blog, then there will be problems... So, I think, whole plugin should be "sandboxed" (i dont know what termin should be used) and whole plugin activation should happen for each sub-site, and not just "myFunc".

Change History (3)

This ticket was mentioned in Slack in #core by markparnell. View the logs.


4 months ago

#2 @markparnell
4 months ago

  • Focuses multisite added
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

@tazotodua it's not entirely clear what you're looking for here - since [16011] the (de)activation hooks are passed the $network_wide parameter which indicates whether the plugin is being network activated. This would allow you to loop through the sub-sites as needed.

As such I'm closing this as a duplicate of #14170 for now. If I've misunderstood or you have a use case which isn't covered by that, please feel free to re-open this ticket and provide some more details. :-)

#3 @SergeyBiryukov
4 months ago

  • Component changed from General to Plugins
Note: See TracTickets for help on using tickets.