From d0b3f6fe711b7e07db86494eb767dc636a620215 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Mon, 16 Oct 2023 13:28:17 -0700 Subject: [PATCH] Site Cloner: Show sites from all networks See https://wordpress.slack.com/archives/C05JYJJRNKB/p1697355669888659 --- .../wordcamp-site-cloner/wordcamp-site-cloner.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public_html/wp-content/plugins/wordcamp-site-cloner/wordcamp-site-cloner.php b/public_html/wp-content/plugins/wordcamp-site-cloner/wordcamp-site-cloner.php index dfe42f571..01c87a400 100755 --- a/public_html/wp-content/plugins/wordcamp-site-cloner/wordcamp-site-cloner.php +++ b/public_html/wp-content/plugins/wordcamp-site-cloner/wordcamp-site-cloner.php @@ -168,8 +168,11 @@ function register_api_endpoints() { * @return array */ function sites_endpoint() { - $sites = array(); - $cached_sites = get_site_option( WORDCAMP_SITES_OPTION_KEY, array() ); + $sites = array(); + + // All networks share this option, but it's stored on the WordCamp network because Core doesn't provide a + // cross-network option. + $cached_sites = get_network_option( WORDCAMP_NETWORK_ID, WORDCAMP_SITES_OPTION_KEY, array() ); if ( $cached_sites ) { unset( $cached_sites[ get_current_blog_id() ] ); @@ -194,7 +197,9 @@ function prime_wordcamp_sites() { return; } - update_site_option( WORDCAMP_SITES_OPTION_KEY, get_wordcamp_sites() ); + // All networks share this option, but it's stored on the WordCamp network because Core doesn't provide a + // cross-network option. + update_network_option( WORDCAMP_NETWORK_ID, WORDCAMP_SITES_OPTION_KEY, get_wordcamp_sites() ); } /**