upskill-event-manager/templates/page-master-dashboard.php
Ben 2f9213e878 fix: critical master dashboard rendering issues identified in zen code review
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 <noreply@anthropic.com>
2025-08-22 11:35:40 -03:00

51 lines
1.4 KiB
PHP

<?php
/**
* Template Name: Master Dashboard
* Description: Template for the master trainer dashboard page
*/
// Define constant to indicate we are in a page template
if (!defined('HVAC_IN_PAGE_TEMPLATE')) {
define('HVAC_IN_PAGE_TEMPLATE', true);
}
get_header();
// Check master trainer permissions FIRST
$user = wp_get_current_user();
if (!in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options')) {
?>
<div class="hvac-page-wrapper">
<div class="container">
<h1>Access Denied</h1>
<p>You do not have permission to access this page.</p>
<p>If you believe this is an error, please contact an administrator.</p>
<a href="<?php echo home_url(); ?>" class="button">Return to Home</a>
</div>
</div>
<?php
get_footer();
exit;
}
// Render master trainer navigation
if (class_exists('HVAC_Master_Menu_System')) {
$master_menu = HVAC_Master_Menu_System::instance();
$master_menu->render_master_menu();
}
// Render breadcrumbs
if (class_exists('HVAC_Breadcrumbs')) {
HVAC_Breadcrumbs::render();
}
echo '<div class="hvac-page-wrapper hvac-master-dashboard-page">';
echo '<div class="container">';
// Render the master dashboard content directly (bypassing shortcode processing)
include HVAC_PLUGIN_DIR . 'templates/template-hvac-master-dashboard.php';
echo '</div>'; // .container
echo '</div>'; // .hvac-page-wrapper
get_footer();