From afc2d4dca661da54f5660cfacfd1645927154007 Mon Sep 17 00:00:00 2001 From: Mike Auteri Date: Sun, 9 Jun 2024 19:08:06 -0400 Subject: [PATCH] Update per Carsten's suggestion. --- includes/core/classes/class-setup.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/core/classes/class-setup.php b/includes/core/classes/class-setup.php index d5d878a13..60234fd51 100644 --- a/includes/core/classes/class-setup.php +++ b/includes/core/classes/class-setup.php @@ -183,14 +183,17 @@ public function filter_plugin_action_links( array $actions ): array { * @return void */ public function activate_gatherpress_plugin( bool $network_wide ): void { - global $wpdb; - if ( is_multisite() && $network_wide ) { - // Get all blogs in the network and activate plugin on each one. - $blog_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT blog_id FROM %i', $wpdb->blogs ) ); // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnsupportedIdentifierPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching + // Get all sites in the network and activate plugin on each one. + $site_ids = get_sites( + array( + 'fields' => 'ids', + 'network_id' => get_current_site()->id, + ) + ); - foreach ( $blog_ids as $blog_id ) { - switch_to_blog( $blog_id ); + foreach ( $site_ids as $site_id ) { + switch_to_blog( $site_id ); $this->create_tables(); restore_current_blog(); }