upskill-event-manager/templates/page-master-events.php
Ben 758307a057 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>
2025-08-22 12:09:06 -03:00

60 lines
No EOL
1.7 KiB
PHP

<?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();