get_option(); if ( !current_user_can( 'manage_options' ) ) { return false; } if ( array_key_exists( WPUF_VERSION, $options ) && $options[WPUF_VERSION] === true ) { return false; } return true; } /** * Mark the current plugin changelog as read * * @return void */ public function mark_read() { $options = $this->get_option(); $options[WPUF_VERSION] = true; update_option( 'wpuf_whats_new', $options ); } /** * Get the changelog history * * @return array */ public function get_option() { return get_option( 'wpuf_whats_new', [] ); } /** * Register the menu page * * @return void */ public function register_menu() { add_submenu_page( null, __( 'Whats New', 'wp-user-frontend' ), __( 'Whats New', 'wp-user-frontend' ), 'manage_options', 'whats-new-wpuf', [ $this, 'menu_page' ] ); } /** * Render the menu page * * @return void */ public function menu_page() { $this->mark_read(); include_once WPUF_ROOT . '/admin/html/whats-new.php'; } /** * Show the admin notice if applicable * * @return void */ public function admin_notice() { if ( !$this->has_new() ) { return; } wp_enqueue_script( 'wp-util' ); ?>
WPUF Icon

%s version.', 'wp-user-frontend' ) ), esc_html( WPUF_VERSION ) ); ?>

mark_read(); wp_send_json_success(); } }