WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 6 months ago

#29411 new enhancement

Add multi-network helper functionality

Reported by: rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: ms-roadmap
Focuses: multisite Cc:

Description

While WP core supports multi-network, there are some pieces of critical functionality missing. Currently, I'm using JJJ's WP Multi Network plugin to provide this, but the utility functions should probably be included with core.

These are:

  • network_exists
  • switch_to_network
  • restore_current_network
  • add_network
  • update_network
  • delete_network
  • move_site
  • user_has_networks

Personally, I'd be in favour of integrating the entirety of wpmn-functions.php verbatim.

Change History (10)

#1 @rmccue
3 years ago

Note: -1 on integrating the UI from the plugin; that's fine in a helper plugin. The core functionality should be enhanced, however.

(Related to the UI: #16900, #21584)

#2 @rmccue
3 years ago

WPMN's switch_to_network and network_exists functions are both currently broken due to #29415.

#3 @nacin
3 years ago

I kind of like multi-network helper functionality remaining outside of core for the time being. Multisite is a moving target and needs a ton of work just to make it not absolutely terrible for *single* networks. Adding this additional layer of complexity feels like the wrong thing to do.

Also, anything that tries to copy switch_to_blog() is gonna have a bad time. I'd rather a new switching mechanism that switches the network, too, if it's different for the new site. I do get that *_site_option() only operates on the current network, which is why I'd like to eventually move toward a _network_option() situation.

Note none of the opinions outlined here are strongly held.

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


3 years ago

#5 @jeremyfelt
2 years ago

See #28290 for *_network_option() progress.

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


11 months ago

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


9 months ago

#8 @flixos90
7 months ago

  • Milestone changed from Awaiting Review to Future Release

As decided recently during multisite office-hours, we wanna have a CRUD API dedicated to networks as part of core in the long run.

While multinetwork will likely always remain plugin territory in the way it is implemented in detail, core should provide a basic API for interacting with the database table, to have a solid common ground that is thoroughly unit-tested.

We already have:

  • WP_Network and WP_Network_Query
  • get_network() and get_networks() (this is the 'R' of the CRUD API)

We need to implement:

  • wp_insert_network()
  • wp_update_network()
  • wp_delete_network()

These three functions should work similarly to their sites counterparts which we're working on in #40364. Let's not start patching this ticket until the related sites functions are set in stone.

@rmccue This decision is obviously only part of what you request above. What are your current thoughts? Should we create a separate ticket for the three functions or work in here?

#9 @flixos90
7 months ago

  • Keywords ms-roadmap added

These tickets belong to our planned roadmap (a few of them not per final decision), so flagging with a keyword for better overview.

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


6 months ago

Note: See TracTickets for help on using tickets.