Tribe__PUE__Notices::maybe_undismiss_notices()
Undismisses license key notifications where appropriate.
The idea is that if an invalid key is detected for one or more plugins, we show a notification until a user dismisses it. That user will not then see the notification again unless or until an additional plugin name is added to the invalid key list.
Example:
- Notification listing "Eventbrite" and "Pro" keys as invalid shows
- User X dismisses the notification
- The "Pro" license is fixed/corrected - notification remains in a "dismissed" status for User X
- "Filter Bar" is added to the list of invalid keys
- The invalid key notification is undismissed, to make all users (including User X) aware of
the problem re Filter Bar
Source
File: src/Tribe/PUE/Notices.php
public function maybe_undismiss_notices() {
foreach ( $this->notices as $notice_type => $plugin_list ) {
if ( is_array( $this->saved_notices ) && ! empty( $this->saved_notices[ $notice_type ] ) ) {
$new_plugins = array_diff_key( $this->notices[ $notice_type ], $this->saved_notices[ $notice_type ] );
} else {
$new_plugins = $this->notices[ $notice_type ];
}
if ( ! empty( $new_plugins ) ) {
Tribe__Admin__Notices::instance()->undismiss_for_all( 'pue_key-' . $notice_type );
}
}
}