Skip to content

Commit

Permalink
Add upgrade notice
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Aug 2, 2023
1 parent 3c0ee1a commit 2ba6f6b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
32 changes: 30 additions & 2 deletions includes/class-activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public static function init() {
\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' ) );
}

/**
Expand Down Expand Up @@ -178,9 +180,9 @@ public static function get_avatar_url( $comment ) {
}

/**
* 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
*/
Expand Down Expand Up @@ -276,4 +278,30 @@ public static function theme_compat() {
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(
'<div class="update-message">%s</div>',
wp_kses(
wpautop( $data['upgrade_notice '] ),
array(
'p' => array(),
'a' => array( 'href', 'title' ),
'strong' => array(),
'em' => array(),
)
)
);
}
}
6 changes: 6 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down

0 comments on commit 2ba6f6b

Please sign in to comment.