Master Dashboard
System Overview
Total Events
Upcoming Events
Completed Events
Active Trainers
Tickets Sold
Total Revenue
$
'; // Ensure user is logged in and has access to the master dashboard if ( ! is_user_logged_in() ) { // Redirect to login page if not logged in wp_safe_redirect( home_url( '/training-login/' ) ); exit; } // Authentication handled by centralized HVAC_Access_Control system // Redundant template-level auth check removed to prevent content blocking // Get current user info $current_user = wp_get_current_user(); $user_id = $current_user->ID; // Check for approval message $approval_message = get_transient( 'hvac_approval_message' ); if ( $approval_message ) { delete_transient( 'hvac_approval_message' ); } // Classes are loaded during plugin initialization $master_data = new HVAC_Master_Dashboard_Data(); // Get statistics $total_events = $master_data->get_total_events_count(); $upcoming_events = $master_data->get_upcoming_events_count(); $past_events = $master_data->get_past_events_count(); $total_tickets_sold = $master_data->get_total_tickets_sold(); $total_revenue = $master_data->get_total_revenue(); $trainer_stats = $master_data->get_trainer_statistics(); // Get events table data (default view) $default_args = array( 'status' => 'all', 'orderby' => 'date', 'order' => 'DESC', 'page' => 1, 'per_page' => 10 ); $events_table_data = $master_data->get_events_table_data( $default_args ); // Get list of all trainers for filter dropdown $all_trainers = get_users(array( 'role__in' => array('hvac_trainer', 'hvac_master_trainer'), 'fields' => array('ID', 'display_name') )); // Error handling for access denied $error_message = ''; if ( isset( $_GET['error'] ) && $_GET['error'] === 'access_denied' ) { $error_message = 'You were redirected here because you do not have permission to access the Master Dashboard.'; } // Note: get_header() is called by the main page template ?>
$