diff --git a/assets/js/src/notice-php-warning.jsx b/assets/js/src/dismissible-notice.jsx similarity index 54% rename from assets/js/src/notice-php-warning.jsx rename to assets/js/src/dismissible-notice.jsx index 8e95a41761..94b1c5095a 100644 --- a/assets/js/src/notice-php-warning.jsx +++ b/assets/js/src/dismissible-notice.jsx @@ -1,8 +1,8 @@ import jQuery from 'jquery'; jQuery(($) => { - $(document).on('click', '.notice-php-warning .notice-dismiss', function xyz() { - const type = $(this).closest('.notice-php-warning').data('notice'); + $(document).on('click', '.mailpoet-dismissible-notice .notice-dismiss', function dismiss() { + const type = $(this).closest('.mailpoet-dismissible-notice').data('notice'); $.ajax(window.ajaxurl, { type: 'POST', diff --git a/lib/Config/Initializer.php b/lib/Config/Initializer.php index eecc1565c6..44723132ac 100644 --- a/lib/Config/Initializer.php +++ b/lib/Config/Initializer.php @@ -8,6 +8,7 @@ use MailPoet\Models\Setting; use MailPoet\Router; use MailPoet\Util\ConflictResolver; use MailPoet\Util\Helpers; +use MailPoet\Util\Notices\PermanentNotices; use MailPoet\WP\Notice as WPNotice; if(!defined('ABSPATH')) exit; @@ -144,7 +145,7 @@ class Initializer { $this->setupPages(); - $this->setupPHPVersionWarnings(); + $this->setupPermanentNotices(); $this->setupDeactivationSurvey(); do_action('mailpoet_initialized', MAILPOET_VERSION); @@ -289,9 +290,9 @@ class Initializer { $erasers->init(); } - function setupPHPVersionWarnings() { - $php_version_warnings = new PHPVersionWarnings(); - $php_version_warnings->init(phpversion(), Menu::isOnMailPoetAdminPage()); + function setupPermanentNotices() { + $notices = new PermanentNotices(); + $notices->init(); } function handleFailedInitialization($exception) { diff --git a/lib/Config/PHPVersionWarnings.php b/lib/Util/Notices/PHPVersionWarnings.php similarity index 73% rename from lib/Config/PHPVersionWarnings.php rename to lib/Util/Notices/PHPVersionWarnings.php index e2ced87ec9..5c30aff69d 100644 --- a/lib/Config/PHPVersionWarnings.php +++ b/lib/Util/Notices/PHPVersionWarnings.php @@ -1,6 +1,6 @@ '_blank')); - $extra_classes = 'notice-php-warning is-dismissible'; + $extra_classes = 'mailpoet-dismissible-notice is-dismissible'; $data_notice_name = 'php-version-outdated'; return WPNotice::displayError($error, $extra_classes, $data_notice_name); } function ajaxDismissNoticeHandler() { + if($_POST['type'] !== 'php-version-outdated') return; set_transient('dismissed-php-version-outdated-notice', true, self::DISMISS_NOTICE_TIMEOUT_SECONDS); } } +\MailPoet\WP\Notice::displaySuccess(Helpers::replaceLinkTags( + __('Congrats! You’re progressing well so far. Complete your upgrade thanks to this [link]checklist[/link].', 'mailpoet'), + 'https://beta.docs.mailpoet.com/article/199-checklist-after-migrating-to-mailpoet3', + array('target' => '_blank') +), 'is-dismissible'); \ No newline at end of file diff --git a/lib/Util/Notices/PermanentNotices.php b/lib/Util/Notices/PermanentNotices.php new file mode 100644 index 0000000000..2124605b58 --- /dev/null +++ b/lib/Util/Notices/PermanentNotices.php @@ -0,0 +1,15 @@ +init(phpversion(), Menu::isOnMailPoetAdminPage()); + } + +} + diff --git a/tests/unit/Config/PHPVersionWarningsTest.php b/tests/unit/Util/Notices/PHPVersionWarningsTest.php similarity index 98% rename from tests/unit/Config/PHPVersionWarningsTest.php rename to tests/unit/Util/Notices/PHPVersionWarningsTest.php index a39ad920e6..c8d109d859 100644 --- a/tests/unit/Config/PHPVersionWarningsTest.php +++ b/tests/unit/Util/Notices/PHPVersionWarningsTest.php @@ -1,6 +1,6 @@