From 2ba6f6b8a7a0cf45c71afb5e80e3b64af4a01765 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Wed, 2 Aug 2023 10:44:56 +0200 Subject: [PATCH] Add upgrade notice --- README.md | 6 ++++++ includes/class-activitypub.php | 32 ++++++++++++++++++++++++++++++-- readme.txt | 6 ++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 256d5b6..55d2895 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,12 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu * initial +## Upgrade Notice ## + +### 1.0.0 ### + +For version 1.0.0 we have completely rebuilt the followers lists. There is a migration from the old format to the new, but it may take some time until the migration is complete. No data will be lost in the process, please give the migration some time. + ## Installation ## Follow the normal instructions for [installing WordPress plugins](https://wordpress.org/support/article/managing-plugins/). diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index da47875..fa2f941 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -31,6 +31,8 @@ class Activitypub { \add_action( 'init', array( self::class, 'add_rewrite_rules' ), 11 ); \add_action( 'after_setup_theme', array( self::class, 'theme_compat' ), 99 ); + + \add_action( 'in_plugin_update_message-' . ACTIVITYPUB_PLUGIN_BASENAME, array( self::class, 'plugin_update_message' ) ); } /** @@ -178,9 +180,9 @@ class Activitypub { } /** - * Store permalink in meta, to send delete Activity + * Store permalink in meta, to send delete Activity. * - * @param string $post_id The Post ID + * @param string $post_id The Post ID. * * @return void */ @@ -276,4 +278,30 @@ class Activitypub { add_theme_support( 'custom-header', $custom_header_args ); } } + + /** + * Display plugin upgrade notice to users + * + * @param array $data The plugin data + * + * @return void + */ + public static function plugin_update_message( $data ) { + if ( ! isset( $data['upgrade_notice'] ) ) { + return; + } + + printf( + '
%s
', + wp_kses( + wpautop( $data['upgrade_notice '] ), + array( + 'p' => array(), + 'a' => array( 'href', 'title' ), + 'strong' => array(), + 'em' => array(), + ) + ) + ); + } } diff --git a/readme.txt b/readme.txt index 27e130f..a494cc5 100644 --- a/readme.txt +++ b/readme.txt @@ -388,6 +388,12 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu * initial +== Upgrade Notice == + += 1.0.0 = + +For version 1.0.0 we have completely rebuilt the followers lists. There is a migration from the old format to the new, but it may take some time until the migration is complete. No data will be lost in the process, please give the migration some time. + == Installation == Follow the normal instructions for [installing WordPress plugins](https://wordpress.org/support/article/managing-plugins/).