diff --git a/includes/class-hvac-master-dashboard-data.php b/includes/class-hvac-master-dashboard-data.php index 20fb672b..1d43e7b8 100644 --- a/includes/class-hvac-master-dashboard-data.php +++ b/includes/class-hvac-master-dashboard-data.php @@ -850,9 +850,16 @@ class HVAC_Master_Dashboard_Data { * AJAX handler for trainers table */ public function ajax_get_trainers_table() { - // Check nonce - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'hvac_master_dashboard_nonce' ) ) { - wp_die( 'Security check failed' ); + // Check nonce - accept both hvac_ajax_nonce and hvac_master_dashboard_nonce for compatibility + if ( ! isset( $_POST['nonce'] ) ) { + wp_die( 'Security check failed: No nonce provided' ); + } + + $nonce_valid = wp_verify_nonce( $_POST['nonce'], 'hvac_ajax_nonce' ) || + wp_verify_nonce( $_POST['nonce'], 'hvac_master_dashboard_nonce' ); + + if ( ! $nonce_valid ) { + wp_die( 'Security check failed: Invalid nonce' ); } // Check permissions diff --git a/includes/class-hvac-plugin.php b/includes/class-hvac-plugin.php index c9ba3593..f239050e 100644 --- a/includes/class-hvac-plugin.php +++ b/includes/class-hvac-plugin.php @@ -500,7 +500,12 @@ final class HVAC_Plugin { if (class_exists('HVAC_Access_Control')) { new HVAC_Access_Control(); } - + + // Initialize Master Dashboard Data to register AJAX handlers + if (class_exists('HVAC_Master_Dashboard_Data')) { + new HVAC_Master_Dashboard_Data(); + } + // Initialize optional components $this->initializeOptionalComponents();