From 886ac8970256553e033ca1952ac9f1290bf39ada Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Thu, 28 Nov 2019 15:53:53 +0530 Subject: [PATCH 1/2] Updater Install Notification should be dismissable, PHWOO-59 --- admin/css/woo-paypal-here-admin.css | 4 ++++ admin/js/woo-paypal-here-admin.js | 17 +++++++++++++++++ includes/angelleye-functions.php | 12 +++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/admin/css/woo-paypal-here-admin.css b/admin/css/woo-paypal-here-admin.css index 9a6ec43..6c857da 100644 --- a/admin/css/woo-paypal-here-admin.css +++ b/admin/css/woo-paypal-here-admin.css @@ -80,4 +80,8 @@ cursor: pointer; color: #C5C5C5; -webkit-font-smoothing: antialiased; +} +.updater-dismissible { + padding-right: 38px; + position: relative; } \ No newline at end of file diff --git a/admin/js/woo-paypal-here-admin.js b/admin/js/woo-paypal-here-admin.js index cdc5eeb..0a548fe 100644 --- a/admin/js/woo-paypal-here-admin.js +++ b/admin/js/woo-paypal-here-admin.js @@ -78,4 +78,21 @@ jQuery(function () { }; jQuery.post(ajaxurl, param); } + jQuery(document).on('click', '#angelleye-updater-notice .notice-dismiss', function( event ) { + var r = confirm("If you do not install the Updater plugin you will not receive automated updates for Angell EYE products going forward!"); + if (r == true) { + data = { + action : 'angelleye_updater_dismissible_admin_notice' + }; + jQuery.post(ajaxurl, data, function (response) { + var $el = jQuery( '#angelleye-updater-notice' ); + event.preventDefault(); + $el.fadeTo( 100, 0, function() { + $el.slideUp( 100, function() { + $el.remove(); + }); + }); + }); + } + }); }); diff --git a/includes/angelleye-functions.php b/includes/angelleye-functions.php index aa876bc..1d33b50 100644 --- a/includes/angelleye-functions.php +++ b/includes/angelleye-functions.php @@ -78,8 +78,14 @@ function angell_updater_notice() { $message = ' Activate the Angell EYE Updater plugin to get updates for your Angell EYE plugins.'; } } - echo '

' . $message . '

' . "\n"; + echo '

' . $message . '

' . "\n"; } - - add_action('admin_notices', 'angell_updater_notice'); + + function angelleye_updater_dismissible_admin_notice() { + set_transient( 'angelleye_updater_notice_hide', 'yes', MONTH_IN_SECONDS ); + } + if ( false === ( $angelleye_updater_notice_hide = get_transient( 'angelleye_updater_notice_hide' ) ) ) { + add_action('admin_notices', 'angell_updater_notice'); + } + add_action( 'wp_ajax_angelleye_updater_dismissible_admin_notice', 'angelleye_updater_dismissible_admin_notice' ); } \ No newline at end of file From ae69da8d631d8e8528c8575f57016151b8b0baad Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Mon, 16 Dec 2019 14:50:17 +0530 Subject: [PATCH 2/2] Updater Install Notification should be dismissable, PHWOO-59 --- admin/js/woo-paypal-here-admin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/js/woo-paypal-here-admin.js b/admin/js/woo-paypal-here-admin.js index 0a548fe..a7b3417 100644 --- a/admin/js/woo-paypal-here-admin.js +++ b/admin/js/woo-paypal-here-admin.js @@ -78,10 +78,10 @@ jQuery(function () { }; jQuery.post(ajaxurl, param); } - jQuery(document).on('click', '#angelleye-updater-notice .notice-dismiss', function( event ) { + jQuery(document).off('click', '#angelleye-updater-notice .notice-dismiss').on('click', '#angelleye-updater-notice .notice-dismiss',function(event) { var r = confirm("If you do not install the Updater plugin you will not receive automated updates for Angell EYE products going forward!"); if (r == true) { - data = { + var data = { action : 'angelleye_updater_dismissible_admin_notice' }; jQuery.post(ajaxurl, data, function (response) {