From 30acc30caf7587c367e8a133da4fcfb6cb097e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Fri, 5 Jul 2024 13:27:49 +0200 Subject: [PATCH] more general admin notices --- .../admin/class-general-admin-notices.php | 28 +++++++++++++++++++ includes/class-setup.php | 3 ++ 2 files changed, 31 insertions(+) diff --git a/includes/admin/class-general-admin-notices.php b/includes/admin/class-general-admin-notices.php index 7c12915..d264638 100644 --- a/includes/admin/class-general-admin-notices.php +++ b/includes/admin/class-general-admin-notices.php @@ -42,4 +42,32 @@ class General_Admin_Notices { ); echo '

' . \wp_kses( $notice, $allowed_html ) . '

'; } + + /** + * Warning that no supported event plugin can be found. + */ + public static function do_admin_notice_no_supported_event_plugin_active() { + $supported_event_plugins_url = 'https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-extensions#events-plugin-that-will-be-supported-at-first'; + + $notice = sprintf( + /* translators: 1: the name of the event plugin a admin notice is shown. 2: The name of the ActivityPub plugin. */ + _x( + 'The Plugin ActivityPub Event Extensions is of no use, because you do not have installed and activated a supported Event Plugin. +
For a list of supported Event Plugins see here.', + 'admin notice', + 'activitypub-event-extensions' + ), + esc_html( $supported_event_plugins_url ), + admin_url( 'options-general.php?page=activitypub&tab=settings' ) + ); + $allowed_html = array( + 'a' => array( + 'href' => true, + 'title' => true, + ), + 'br', + 'i', + ); + echo '

' . \wp_kses( $notice, $allowed_html ) . '

'; + } } diff --git a/includes/class-setup.php b/includes/class-setup.php index 088f6e5..8ce20b6 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -153,6 +153,9 @@ class Setup { if ( ! $this->activitypub_plugin_is_active ) { add_action( 'admin_notices', array( new General_Admin_Notices(), 'do_admin_notice_activitypub_plugin_not_enabled' ), 10, 1 ); } + if ( empty( $this->active_event_plugins ) ) { + add_action( 'admin_notices', array( new General_Admin_Notices(), 'do_admin_notice_no_supported_event_plugin_active' ), 10, 1 ); + } } /**