Skip to content

Commit

Permalink
Merge pull request #739 from GatherPress/GP-737
Browse files Browse the repository at this point in the history
GP-737: Add GatherPress Alpha warning.
  • Loading branch information
mauteri authored Jul 28, 2024
2 parents ecca619 + 943f0e8 commit 9aabb26
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
22 changes: 22 additions & 0 deletions includes/core/classes/class-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected function setup_hooks(): void {

add_action( 'init', array( $this, 'maybe_flush_rewrite_rules' ) );
add_action( 'admin_notices', array( $this, 'check_users_can_register' ) );
add_action( 'admin_init', array( $this, 'check_gatherpress_alpha' ) );
add_action( 'wp_initialize_site', array( $this, 'on_site_create' ) );

add_filter( 'block_categories_all', array( $this, 'register_gatherpress_block_category' ) );
Expand Down Expand Up @@ -412,4 +413,25 @@ public function check_users_can_register(): void {
);
}
}

/**
* Checks if the GatherPress Alpha plugin is active and renders an admin notice if not.
*
* This method verifies whether the GatherPress Alpha plugin is currently active.
* If the plugin is not active, it renders an admin notice template to inform the user
* that the GatherPress Alpha plugin is required for compatibility and development purposes.
*
* @since 1.0.0
*
* @return void
*/
public function check_gatherpress_alpha(): void {
if ( ! is_plugin_active( 'gatherpress-alpha/gatherpress-alpha.php' ) ) {
Utility::render_template(
sprintf( '%s/includes/templates/admin/setup/gatherpress-alpha-check.php', GATHERPRESS_CORE_PATH ),
array(),
true
);
}
}
}
24 changes: 24 additions & 0 deletions includes/templates/admin/setup/gatherpress-alpha-check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Admin Notice for GatherPress Alpha check.
*
* @package GatherPress\Core
* @since 1.0.0
*/

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore

?>
<div class="notice notice-warning is-dismissible">
<p>
<?php
echo wp_kses_post(
__(
'The GatherPress Alpha plugin is not installed or activated. This plugin is currently in heavy development and requires GatherPress Alpha to handle breaking changes. Please <a href="https://github.com/GatherPress/gatherpress-alpha" target="_blank">download and install GatherPress Alpha</a> to ensure compatibility and avoid issues.',
'gatherpress'
)
);
?>
</p>
</div>

0 comments on commit 9aabb26

Please sign in to comment.