Skip to content

Commit

Permalink
Detects if a user is using the correct upstream and framework and giv…
Browse files Browse the repository at this point in the history
…e them appropriate next steps to finalize WPMS setup. (#21)

* Update pantheon.php to declare WP_ALLOW_MULTISITE before loading network config

* Detects if a user is using the correct upstream and framework and give them appropriate next steps to finalize WPMS setup.
  • Loading branch information
carl-alberto authored May 11, 2023
1 parent a185eeb commit 5ac00de
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
33 changes: 27 additions & 6 deletions inc/pantheon-multisite-finalize.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
<?php
/*
/**
* If a site has multisite enabled, but has not had the final installation
* steps completed, alert the user and provide links.
*
* @package pantheon
*/

function pantheon_multisite_install_finalize_message() {
?>
/**
* Detects if a user is using the correct upstream and framework and give them appropriate next steps to finalize WPMS setup.
*
* @return void
*/
function pantheon_multisite_install_finalize_message() { ?>
<div class="notice notice-info is-dismissible">
<p><?php esc_html_e( 'Your WordPress Multisite is almost ready!', 'pantheon' ); ?></p>
<p><?php echo sprintf( __( 'Visit <a href="%s">Pantheon Multisite Configuration</a> for documentation on how to finalize configuration of your site network.', 'pantheon' ), 'https://pantheon.io/docs/guides/multisite/config/#install-the-wordpress-site-network' ); ?></p>
<?php
if ( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ) {
if ( getenv( 'FRAMEWORK' ) === 'wordpress_network' ) {
?>
<p><?php esc_html_e( 'Your WordPress Multisite is almost ready!', 'pantheon' ); ?></p>
<p><?php echo sprintf( __( 'Visit <a href="%s">Pantheon Multisite Configuration</a> for documentation on how to finalize configuration of your site network.', 'pantheon' ), 'https://pantheon.io/docs/guides/multisite/config/#install-the-wordpress-site-network' ); ?></p>
<?php
} else {
?>
<p><?php esc_html_e( 'You are trying to configure a WordPress Multisite with a wrong upstream!', 'pantheon' ); ?></p>
<p><?php echo sprintf( __( 'Make sure that you have the correct upstream configuration for WPMS. If you do not have that capability or check if you are eligible, please <a href="%s">Contact Support</a>.', 'pantheon' ), 'https://pantheon.io/support' ); ?></p>
<?php
}
}
?>
</div>


<?php
}

add_action('admin_notices', 'pantheon_multisite_install_finalize_message');
add_action( 'admin_notices', 'pantheon_multisite_install_finalize_message' );
6 changes: 3 additions & 3 deletions pantheon.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once 'inc/cli.php';
}
if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
require_once 'inc/pantheon-network-setup.php';
}
if ( ! defined( 'FS_METHOD' ) ) {
/**
* When this constant is not set, WordPress writes and then deletes a
Expand All @@ -45,6 +42,9 @@
if ( getenv( 'FRAMEWORK' ) === 'wordpress_network' && ! defined( 'WP_ALLOW_MULTISITE' ) ) {
define( 'WP_ALLOW_MULTISITE', true );
}
if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
require_once 'inc/pantheon-network-setup.php';
}
if ( defined( 'WP_ALLOW_MULTISITE' ) && ( ! defined( 'MULTISITE' ) || empty( MULTISITE ) ) ) {
require_once 'inc/pantheon-multisite-finalize.php';
}
Expand Down

0 comments on commit 5ac00de

Please sign in to comment.