MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: machen (1008)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /disk001/machen/public_html/support/wp-content/themes/wp-moose/inc/admin-page.php
<?php

// Add Moose Admin Page
if ( ! function_exists( 'wp_moose_admin_page' ) ) {
	function wp_moose_admin_page() {
		add_theme_page(
			esc_html__( 'WP Moose Theme', 'wp-moose' ),
			esc_html__( 'WP Moose Theme', 'wp-moose' ),
			'edit_theme_options',
			'wp-moose-theme',
			'wp_moose_admin_page_output'
		);
	}
}
add_action( 'admin_menu', 'wp_moose_admin_page' );

if ( ! function_exists( 'wp_moose_admin_notices' ) ) {
	/**
	 * Show admin notices
	 */
	function wp_moose_admin_notices() {
		$screen = get_current_screen();
		if ( 'appearance_page_wp_moose_theme' !== $screen->id ) {
			get_template_part( 'template-parts/admin', 'notices' );
		}
	}
}
add_action( 'admin_notices', 'wp_moose_admin_notices' );

if ( ! function_exists( 'wp_moose_dismiss_notice' ) ) {
	/**
	 * Dismiss admin notice
	 */
	function wp_moose_dismiss_notice() {
		global $current_user;

		$user_id = $current_user->ID;

		$dismiss_option = filter_input( INPUT_GET, 'wp_moose_dismiss', FILTER_SANITIZE_STRING );
		if ( is_string( $dismiss_option ) && in_array( $dismiss_option, array( 'welcome' ) ) ) {
			add_user_meta( $user_id, "wp_moose_dismissed_$dismiss_option", 'true', true );
			// delete_user_meta( $user_id, "wp_moose_dismissed_$dismiss_option", 'true', true );
			wp_die( '', '', array( 'response' => 200 ) );
		}
	}
}
add_action( 'admin_init', 'wp_moose_dismiss_notice' );

if ( ! function_exists( 'wp_moose_admin_page_output' ) ) {
	/**
	 * Show admin welcome page
	 */
	function wp_moose_admin_page_output() {
		get_template_part( 'template-parts/admin', 'welcome' );
	}
}