Skip to content

Commit

Permalink
Add upgrade notice for future versions
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnbent committed Mar 7, 2022
1 parent ce88a45 commit 0e7bccc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 372 deletions.
14 changes: 14 additions & 0 deletions includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function init() {
add_action('activated_plugin', __NAMESPACE__ . "\\activate");
add_action('init', __NAMESPACE__ . "\\onInit");
do_action( 'wordproof_scaffold_init' );
add_action('in_plugin_update_message-' . WORDPROOF_BASENAME, __NAMESPACE__ . '\\displayUpgradeNotification', 10, 2);
}

/**
Expand Down Expand Up @@ -95,3 +96,16 @@ function activate($plugin) {
function deactivate() {

}

/**
* Display a upgrade notifications on plugins.php according to line in readme.
*
* @param $currentPluginMetadata
* @param $newPluginMetadata
*/
function displayUpgradeNotification( $currentPluginMetadata, $newPluginMetadata ) {
if ( isset( $newPluginMetadata->upgrade_notice ) && strlen( trim( $newPluginMetadata->upgrade_notice ) ) > 0 ) {
echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>Important Upgrade Notice:</strong> ';
echo esc_html( $newPluginMetadata->upgrade_notice ), '</p>';
}
}
Loading

0 comments on commit 0e7bccc

Please sign in to comment.