upskill-event-manager/templates/page-manage-event.php
ben 46266aa894 feat: expand access permissions for master trainers and administrators
- Update HVAC_Access_Control to allow master trainers access to all trainer pages
- Add administrator permission checks to template security validations
- Enable administrators and master trainers to access event creation and management
- Update AJAX handlers to include administrator permission validation
- Fix syntax error in page-manage-event.php template redirect

This ensures proper role hierarchy where administrators have full access,
master trainers can access both trainer and master sections, and regular
trainers maintain existing trainer-only access.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 10:16:09 -03:00

37 lines
1.1 KiB
PHP

<?php
/**
* Template Name: Manage Event (Redirect)
* Description: Redirects to integrated HVAC event management system
*/
// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);
// Security check
if (!is_user_logged_in()) {
wp_redirect(home_url('/training-login/'));
exit;
}
// Check user roles - allow trainers, master trainers, and administrators
$user = wp_get_current_user();
if (!array_intersect(['hvac_trainer', 'hvac_master_trainer'], $user->roles) && !current_user_can('manage_options')) {
wp_die(__('Access denied. Trainer role required.', 'hvac-community-events'));
}
// Redirect to integrated event management page
$redirect_url = home_url('/trainer/event/manage/');
// Preserve query parameters if present
if (!empty($_GET)) {
$redirect_url = add_query_arg($_GET, $redirect_url);
}
// Log the redirect for debugging (if debug mode is enabled)
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('Phase 2: Redirecting page-manage-event.php to integrated version: ' . $redirect_url);
}
// Perform the redirect
wp_safe_redirect($redirect_url, 301);
exit;