fix: create missing master trainer pages to resolve 404 errors

Critical page creation fixes identified in headed browser testing:

1. Page Manager Updates (class-hvac-page-manager.php):
   - Add master-trainer/trainers page definition
   - Add master-trainer/events page definition
   - Add master-trainer/communication-templates page definition
   - All pages configured with proper templates and capabilities

2. Template Creation:
   - Create page-master-trainers.php for All Trainers management
   - Create page-master-events.php for Events Management
   - Both templates include proper security checks and navigation

These fixes resolve 404 errors discovered in authentic browser testing:
- master-trainer/trainers/ now has proper page definition
- master-trainer/events/ page created for navigation consistency
- All master trainer navigation links will work after deployment

Navigation structure now complete:
 Dashboard (working)
 Trainers (fixed - was 404)
 Events (created)
 Tools/Communication Templates (existing)
 Help (working)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ben 2025-08-22 12:09:06 -03:00
parent 2f9213e878
commit 758307a057
3 changed files with 141 additions and 0 deletions

View file

@ -384,6 +384,27 @@ class HVAC_Page_Manager {
'parent' => 'master-trainer', 'parent' => 'master-trainer',
'capability' => 'hvac_master_trainer' 'capability' => 'hvac_master_trainer'
], ],
'master-trainer/trainers' => [
'title' => 'All Trainers',
'template' => 'page-master-trainers.php',
'public' => false,
'parent' => 'master-trainer',
'capability' => 'hvac_master_trainer'
],
'master-trainer/events' => [
'title' => 'Events Management',
'template' => 'page-master-events.php',
'public' => false,
'parent' => 'master-trainer',
'capability' => 'hvac_master_trainer'
],
'master-trainer/communication-templates' => [
'title' => 'Communication Templates',
'template' => 'page-master-communication-templates.php',
'public' => false,
'parent' => 'master-trainer',
'capability' => 'hvac_master_trainer'
],
'trainer/resources' => [ 'trainer/resources' => [
'title' => 'Resources', 'title' => 'Resources',
'template' => 'page-trainer-resources.php', 'template' => 'page-trainer-resources.php',

View file

@ -0,0 +1,60 @@
<?php
/**
* Template Name: Master Events
* Description: Template for the master trainer's events management 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-events-page">';
echo '<div class="container">';
// Render the master events content
echo '<h1>Events Management</h1>';
echo '<div class="hvac-master-events-content">';
// For now, render the shortcode - this can be enhanced later with direct content
if (function_exists('hvac_render_master_events')) {
echo hvac_render_master_events();
} else {
echo do_shortcode('[hvac_master_events]');
}
echo '</div>'; // .hvac-master-events-content
echo '</div>'; // .container
echo '</div>'; // .hvac-page-wrapper
get_footer();

View file

@ -0,0 +1,60 @@
<?php
/**
* Template Name: Master Trainers
* Description: Template for the master trainer's all trainers management 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-trainers-page">';
echo '<div class="container">';
// Render the master trainers content
echo '<h1>All Trainers</h1>';
echo '<div class="hvac-master-trainers-content">';
// For now, render the shortcode - this can be enhanced later with direct content
if (function_exists('hvac_render_master_trainers')) {
echo hvac_render_master_trainers();
} else {
echo do_shortcode('[hvac_master_trainers]');
}
echo '</div>'; // .hvac-master-trainers-content
echo '</div>'; // .container
echo '</div>'; // .hvac-page-wrapper
get_footer();