Skip to content

Commit fb23fdf

Browse files
committed
Upgrade notice now hides forever if requested by user
1 parent fb7b057 commit fb23fdf

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

includes/admin/class-alnp-admin-notices.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Display notices in the WordPress admin.
44
*
55
* @since 1.3.2
6-
* @version 1.5.13
6+
* @version 1.5.14
77
* @author Sébastien Dumont
88
* @category Admin
99
* @package Auto Load Next Post/Admin/Notices
@@ -77,9 +77,10 @@ public function check_wp() {
7777
/**
7878
* Don't bug the user if they don't want to see any notices.
7979
*
80-
* @access public
81-
* @since 1.5.0
82-
* @global $current_user
80+
* @access public
81+
* @since 1.5.0
82+
* @version 1.5.14
83+
* @global $current_user
8384
*/
8485
public function dont_bug_me() {
8586
global $current_user;
@@ -92,6 +93,12 @@ public function dont_bug_me() {
9293
$user_hidden_notice = true;
9394
}
9495

96+
// If the user is allowed to install plugins and requested to hide the upgrade notice then hide it for that user.
97+
if ( ! empty( $_GET['hide_auto_load_next_post_upgrade_notice'] ) && current_user_can( 'install_plugins' ) ) {
98+
add_user_meta( $current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1', true );
99+
$user_hidden_notice = true;
100+
}
101+
95102
// If the user is allowed to install plugins and requested to hide the welcome notice then hide it for that user.
96103
if ( ! empty( $_GET['hide_auto_load_next_post_welcome_notice'] ) && current_user_can( 'install_plugins' ) ) {
97104
add_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true );
@@ -116,7 +123,7 @@ public function dont_bug_me() {
116123
*
117124
* @access public
118125
* @since 1.3.2
119-
* @version 1.5.13
126+
* @version 1.5.14
120127
* @global $current_user
121128
* @return void|bool
122129
*/
@@ -188,7 +195,9 @@ public function add_notices() {
188195
// Upgrade warning notice that will disappear once the new release is installed.
189196
$upgrade_version = '1.6.0';
190197

191-
if ( version_compare( AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<' ) ) {
198+
$user_hidden_upgrade = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1' );
199+
200+
if ( version_compare( AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<' ) && empty( $user_hidden_upgrade ) ) {
192201
add_action( 'admin_notices', array( $this, 'upgrade_warning' ) );
193202
}
194203
} // END add_notices()

0 commit comments

Comments
 (0)