}
);
- if ( empty( get_option( GLM_SERVERSTATS_PLUGIN_RELAY_DISMISS ) ) ) {
- add_action(
- 'admin_notices',
- function(){
- $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
- if ( $page === 'glm-info-main-menu' ) {
- return false;
- }
- echo '<div class="glm-serverstatus-notice updated notice is-dismissible">';
- // Grab the cached notice.
- $latest = get_option( GLM_SERVERSTATS_PLUGIN_RELAY_LATEST, false );
- $latest_data = unserialize( $latest );
-
- echo '<div style="display:inline-block;clear: left;">';
- echo '<p><b>Gaslight Media Notification: </b><br>';
- echo '<p><b>'.$latest_data['title'].'</b><br>';
- echo wpautop( $latest_data['dashboard_message'] );
- echo '</p></div>';
- echo '<p><a href="' . admin_url( 'admin.php' ) . '?page=glm-info-main-menu">More Details</a></p>';
- echo '</div>';
- }, 10, 1
- );
+ $latest = get_option( GLM_SERVERSTATS_PLUGIN_RELAY_LATEST, false );
+ if ( $latest ) {
+ $latest_data = unserialize( $latest );
+ if ( $latest_data['title'] && $latest_data['dashboard_message'] ) {
+ if ( empty( get_option( GLM_SERVERSTATS_PLUGIN_RELAY_DISMISS ) ) ) {
+ add_action(
+ 'admin_notices',
+ function(){
+ $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
+ if ( $page === 'glm-info-main-menu' ) {
+ return false;
+ }
+ echo '<div class="glm-serverstatus-notice updated notice is-dismissible">';
+ // Grab the cached notice.
+ $latest = get_option( GLM_SERVERSTATS_PLUGIN_RELAY_LATEST, false );
+ $latest_data = unserialize( $latest );
+
+ echo '<div style="display:inline-block;clear: left;">';
+ echo '<p><b>Gaslight Media Notification: </b><br>';
+ echo '<p><b>'.$latest_data['title'].'</b><br>';
+ echo wpautop( $latest_data['dashboard_message'] );
+ echo '</p></div>';
+ echo '<p><a href="' . admin_url( 'admin.php' ) . '?page=glm-info-main-menu">More Details</a></p>';
+ echo '</div>';
+ }, 10, 1
+ );
+ }
+
+ }
}
add_action( 'admin_enqueue_scripts', function(){