fix(master-dashboard): Resolve trainers table AJAX loading error
Some checks failed
HVAC Plugin CI/CD Pipeline / Security Analysis (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Code Quality & Standards (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Unit Tests (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Integration Tests (push) Has been cancelled
Security Monitoring & Compliance / Dependency Vulnerability Scan (push) Has been cancelled
Security Monitoring & Compliance / Secrets & Credential Scan (push) Has been cancelled
Security Monitoring & Compliance / WordPress Security Analysis (push) Has been cancelled
Security Monitoring & Compliance / Static Code Security Analysis (push) Has been cancelled
Security Monitoring & Compliance / Security Compliance Validation (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Deploy to Production (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Notification (push) Has been cancelled
Security Monitoring & Compliance / Security Summary Report (push) Has been cancelled
Security Monitoring & Compliance / Security Team Notification (push) Has been cancelled
Some checks failed
HVAC Plugin CI/CD Pipeline / Security Analysis (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Code Quality & Standards (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Unit Tests (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Integration Tests (push) Has been cancelled
Security Monitoring & Compliance / Dependency Vulnerability Scan (push) Has been cancelled
Security Monitoring & Compliance / Secrets & Credential Scan (push) Has been cancelled
Security Monitoring & Compliance / WordPress Security Analysis (push) Has been cancelled
Security Monitoring & Compliance / Static Code Security Analysis (push) Has been cancelled
Security Monitoring & Compliance / Security Compliance Validation (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Deploy to Production (push) Has been cancelled
HVAC Plugin CI/CD Pipeline / Notification (push) Has been cancelled
Security Monitoring & Compliance / Security Summary Report (push) Has been cancelled
Security Monitoring & Compliance / Security Team Notification (push) Has been cancelled
- Initialize HVAC_Master_Dashboard_Data during plugin init to ensure AJAX handler is registered for all requests (not just template loads) - Accept both hvac_ajax_nonce and hvac_master_dashboard_nonce for backward compatibility with existing JavaScript 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8a8f1d78df
commit
3d66756715
2 changed files with 16 additions and 4 deletions
|
|
@ -850,9 +850,16 @@ class HVAC_Master_Dashboard_Data {
|
||||||
* AJAX handler for trainers table
|
* AJAX handler for trainers table
|
||||||
*/
|
*/
|
||||||
public function ajax_get_trainers_table() {
|
public function ajax_get_trainers_table() {
|
||||||
// Check nonce
|
// Check nonce - accept both hvac_ajax_nonce and hvac_master_dashboard_nonce for compatibility
|
||||||
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'hvac_master_dashboard_nonce' ) ) {
|
if ( ! isset( $_POST['nonce'] ) ) {
|
||||||
wp_die( 'Security check failed' );
|
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
|
// Check permissions
|
||||||
|
|
|
||||||
|
|
@ -501,6 +501,11 @@ final class HVAC_Plugin {
|
||||||
new 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
|
// Initialize optional components
|
||||||
$this->initializeOptionalComponents();
|
$this->initializeOptionalComponents();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue