From 2f9213e87888c431f07bcb610b8b767eba958002 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 22 Aug 2025 11:35:40 -0300 Subject: [PATCH] fix: critical master dashboard rendering issues identified in zen code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address top 3 critical issues preventing dashboard content from rendering: 1. HTML Injection Fix (class-hvac-community-events.php:924-927): - Move error div from wp_head to wp_footer with proper styling - Prevent markup corruption that breaks content rendering - Add proper escaping with esc_html() 2. Remove Template Redundancy (class-hvac-community-events.php): - Remove force_master_dashboard_content() method and filter - Eliminate competing content injection mechanisms - Simplify to single template_include approach 3. Navigation System Integration (class-hvac-master-menu-system.php): - Align DOM IDs with existing JavaScript expectations - Change wrapper classes to match existing CSS hooks - Fix capability vs role filtering logic 4. Template Safety (page-master-dashboard.php): - Guard constant definition to prevent redefinition notices These fixes resolve zen GPT-5 identified issues: - [CRITICAL] HTML in wp_head breaking content display - [HIGH] Redundant template mechanisms causing conflicts - [HIGH] CSS/JS integration mismatches preventing navigation - [MEDIUM] Capability filtering using role names incorrectly Architecture improvements maintain security while fixing execution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- includes/class-hvac-community-events.php | 20 +++------------ includes/class-hvac-master-menu-system.php | 30 +++++++++++++++++----- templates/page-master-dashboard.php | 4 ++- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/includes/class-hvac-community-events.php b/includes/class-hvac-community-events.php index 4c31eb10..2d45e6d1 100644 --- a/includes/class-hvac-community-events.php +++ b/includes/class-hvac-community-events.php @@ -151,8 +151,6 @@ class HVAC_Community_Events { // Template loading for custom pages add_filter('template_include', array($this, 'load_custom_templates'), 999); - // Force correct content on master dashboard - add_filter('the_content', array($this, 'force_master_dashboard_content'), 1); // Force content on edit event page add_filter('the_content', array($this, 'force_edit_event_content'), 1); @@ -921,9 +919,9 @@ class HVAC_Community_Events { HVAC_Logger::error("Template validation failed in load_custom_templates: {$validation}", 'Core'); // Display error or fallback template - add_action('wp_head', function() use ($validation) { - echo '
There was a problem loading this page. ' . - 'The administrator has been notified. Please try again later.
'; + add_action('wp_footer', function() use ($validation) { + echo '
' . + esc_html('There was a problem loading this page. The administrator has been notified. Please try again later.') . '
'; }); // Either fall back to the standard WP template or use a simple error template @@ -939,18 +937,6 @@ class HVAC_Community_Events { return $template; } // End load_custom_templates - /** - * Force master dashboard content on master dashboard page - */ - public function force_master_dashboard_content($content) { - // Only on master dashboard page - if (is_page('master-trainer/master-dashboard') && in_the_loop() && is_main_query()) { - // Return the master dashboard content - return $this->render_master_dashboard(); - } - - return $content; - } /** * Force edit event content on edit event page diff --git a/includes/class-hvac-master-menu-system.php b/includes/class-hvac-master-menu-system.php index 05fdb1a2..2b9912b3 100644 --- a/includes/class-hvac-master-menu-system.php +++ b/includes/class-hvac-master-menu-system.php @@ -82,17 +82,17 @@ class HVAC_Master_Menu_System { $menu_items = $this->get_master_menu_structure(); - echo '
'; - echo '