<?php

/*
 * Plugin Name: Mostrar alerta en Dashboard de sitio Backup
 */

$backup_domain = "backup.".$_SERVER["SERVER_NAME"];
$ip = $_SERVER["SERVER_ADDR"];
$backup_ip = gethostbyname($backup_domain);


//mostrar widget en network admin dashboard
if ($ip==$backup_ip) {
        add_action('wp_network_dashboard_setup', 'my_network_dashboard_widgets');
        add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
}

function my_network_dashboard_widgets() {
global $wp_meta_boxes;

add_meta_box('backup_site_alert_nwdashboard', 'Backup Site Alert', 'network_dashboard_alert', 'dashboard-network', 'normal', 'high');
}

function network_dashboard_alert() {
echo '<p style="color: red; font-weight:bold; font-size: 2em">ESTE ES EL SITIO BACKUP!!!</a></p>';
}

//mostrar widget en dashboard de subsitios

function my_custom_dashboard_widgets() {
global $wp_meta_boxes;

//add_meta_box('backup_site_alert_dashboard', 'Backup Site Alert', 'custom_dashboard_alert', 'dashboard-network', 'normal', 'high');
wp_add_dashboard_widget('backup_site_alert_dashboard', 'Backup Site Alert', 'custom_dashboard_alert');
}

function custom_dashboard_alert() {
echo '<p style="color: red; font-weight:bold; font-size: 2em">ESTE ES EL SITIO BACKUP!!!</a></p>';
}
