carlomanf / wp-super-network

Share content between wordpress sites and create offspring networks.
https://wordpress.org/plugins/wp-super-network/
3 stars 0 forks source link

Replace `wpdb::__get` with native `Blog::table` #22

Open carlomanf opened 1 year ago

carlomanf commented 1 year ago

The query transformations often make use of wpdb::__get, which was always intended to be a temporary measure. The use of the global variable means that the query does not get correctly transformed if a blog happens to be queried without being switched to.

Instead, there should be an object for the current blog, which can return its table names with Blog::table and will assist with transforming the query for subnetworks. (see #2)

carlomanf commented 1 year ago

if a blog happens to be queried without being switched to.

This point opens a can of worms because the question becomes whether a query should be transformed for a blog that does not have the plugin active. The plugin is required to be activated network-wide to avoid such a scenario within a network, but when subnetworks are possible, there might need to be a similar mechanism to ensure that the plugin is active on every subnetwork of a given root network.

A forced form of #4 for the active plugins sitemeta value is a possible idea.