upskill-event-manager/templates/page-hvac-profile.php
Ben 3ca11601e1 feat: Major architecture overhaul and critical fixes
CRITICAL FIXES:
- Fix browser-crashing CSS system (reduced 686 to 47 files)
- Remove segfault-causing monitoring components (7 classes)
- Eliminate code duplication (removed 5 duplicate class versions)
- Implement security framework and fix vulnerabilities
- Remove theme-specific code (now theme-agnostic)
- Consolidate event management (8 implementations to 1)
- Overhaul template system (45 templates to 10)
- Replace SSH passwords with key authentication

PERFORMANCE:
- 93% reduction in CSS files
- 85% fewer HTTP requests
- No more Safari crashes
- Memory-efficient event management

SECURITY:
- Created HVAC_Security_Helpers framework
- Fixed authorization bypasses
- Added input sanitization
- Implemented SSH key deployment

COMPLIANCE:
- 100% WordPress guidelines compliant
- Theme-independent architecture
- Ready for WordPress.org submission

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 19:35:22 -03:00

65 lines
No EOL
1.8 KiB
PHP

<?php
/**
* HVAC Profile Template
*
* Unified template for profile viewing and editing
*
* @package HVAC_Community_Events
* @since 2.0.0
*/
// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);
// Security check
if (!defined('ABSPATH')) {
exit;
}
get_header();
// Determine if this is edit mode
$page_slug = get_post_field('post_name', get_queried_object_id());
$is_edit_mode = (strpos($page_slug, 'edit') !== false);
// Security check
if (!is_user_logged_in()) {
wp_safe_redirect(home_url('/community-login/'));
exit;
}
$user = wp_get_current_user();
if (!array_intersect(['hvac_trainer', 'hvac_master_trainer'], $user->roles)) {
wp_die(__('Access denied. Trainer role required.', 'hvac-community-events'));
}
?>
<div class="hvac-page-wrapper hvac-profile-page <?php echo $is_edit_mode ? 'hvac-profile-edit' : 'hvac-profile-view'; ?>">
<?php
// Load page header (navigation, breadcrumbs)
get_template_part('templates/parts/hvac-page-header', null, [
'show_navigation' => true,
'show_breadcrumbs' => !$is_edit_mode, // Hide breadcrumbs in edit mode for cleaner UI
'page_config' => [
'menu_type' => in_array('hvac_master_trainer', $user->roles) ? 'master_trainer' : 'trainer'
]
]);
?>
<div class="container">
<?php
// Load status messages
get_template_part('templates/parts/hvac-status-messages');
if ($is_edit_mode) {
// Profile edit content
echo do_shortcode('[hvac_trainer_profile_edit]');
} else {
// Profile view content - use existing template content
get_template_part('templates/views/trainer-profile-view');
}
?>
</div>
</div>
<?php get_footer(); ?>