Skip to content

Commit

Permalink
Update per Carsten's suggestion.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauteri committed Jun 9, 2024
1 parent 9542a00 commit afc2d4d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions includes/core/classes/class-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit afc2d4d

Please sign in to comment.