- Add comprehensive Training Leads system for HVAC trainers * New /trainer/training-leads/ page with tabular contact submission display * HVAC_Training_Leads class with AJAX status updates and filtering * Empty state messaging and profile sharing CTA * Database integration with existing contact forms system - Restructure trainer navigation menu for better UX * Rename "Customize" to "Profile" with logical groupings * Move "Logout" under "Profile" submenu * Change "Personal Profile" to "Trainer Profile" * Add "Training Leads" under Profile section * Update help menu to show only question mark icon positioned far right - Enhance documentation system * Fix /trainer/documentation/ page styling and navigation integration * Update content to reflect current platform features * Add Training Leads documentation and navigation guide * Implement proper WordPress template structure - Update user management * Change joe@upskillhvac.com display name to "Joe Medosch" * Assign Joe as author of measureQuick headquarters venue * Assign Joe as author of measureQuick and Upskill HVAC organizers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
333 lines
17 KiB
PHP
333 lines
17 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: Trainer Profile
|
|
* Description: Template for viewing trainer profile
|
|
*/
|
|
|
|
// Define constant to indicate we are in a page template
|
|
define('HVAC_IN_PAGE_TEMPLATE', true);
|
|
|
|
get_header();
|
|
?>
|
|
|
|
|
|
<div class="hvac-page-wrapper hvac-trainer-profile-page">
|
|
<?php
|
|
// Display trainer navigation menu
|
|
if (class_exists('HVAC_Menu_System')) {
|
|
HVAC_Menu_System::instance()->render_trainer_menu();
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
// Display breadcrumbs
|
|
if (class_exists('HVAC_Breadcrumbs')) {
|
|
echo HVAC_Breadcrumbs::instance()->render_breadcrumbs();
|
|
}
|
|
?>
|
|
<div class="container">
|
|
<?php
|
|
// Check if user is logged in and has proper permissions
|
|
if (!is_user_logged_in()) {
|
|
echo '<p>You must be logged in to view this page.</p>';
|
|
get_footer();
|
|
return;
|
|
}
|
|
|
|
if (!current_user_can('hvac_trainer') && !current_user_can('hvac_master_trainer') && !current_user_can('administrator')) {
|
|
echo '<p>You must be a trainer to view this page.</p>';
|
|
get_footer();
|
|
return;
|
|
}
|
|
|
|
$user_id = get_current_user_id();
|
|
|
|
// Get trainer profile using new system
|
|
$profile_manager = HVAC_Trainer_Profile_Manager::get_instance();
|
|
$profile = $profile_manager->get_trainer_profile($user_id);
|
|
|
|
if (!$profile) {
|
|
echo '<p>No trainer profile found. Please contact an administrator.</p>';
|
|
get_footer();
|
|
return;
|
|
}
|
|
|
|
// Get profile metadata
|
|
$profile_meta = $profile_manager->get_profile_meta($profile->ID);
|
|
$user = get_userdata($user_id);
|
|
|
|
// Get coordinates if available
|
|
$geocoding_service = HVAC_Geocoding_Service::get_instance();
|
|
$coordinates = $geocoding_service->get_coordinates($profile->ID);
|
|
?>
|
|
|
|
<div class="hvac-trainer-profile-view">
|
|
<div class="hvac-page-header">
|
|
<h1>Trainer Profile</h1>
|
|
<div class="hvac-page-header-actions">
|
|
<a href="/trainer/profile/edit/" class="hvac-button hvac-button-primary">Edit Profile</a>
|
|
<button type="button" class="hvac-button hvac-button-secondary hvac-share-profile-btn" data-profile-id="<?php echo esc_attr($profile->ID); ?>">
|
|
<span class="dashicons dashicons-share"></span> Share Profile
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hvac-profile-content">
|
|
<div class="hvac-profile-sidebar">
|
|
<div class="hvac-profile-photo">
|
|
<?php if (has_post_thumbnail($profile->ID)): ?>
|
|
<?php echo get_the_post_thumbnail($profile->ID, 'medium', ['alt' => $user->display_name]); ?>
|
|
<?php else: ?>
|
|
<div class="hvac-profile-photo-placeholder">
|
|
<span><?php echo esc_html(substr($user->first_name, 0, 1) . substr($user->last_name, 0, 1)); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="hvac-profile-stats">
|
|
<div class="hvac-stat-item">
|
|
<span class="hvac-stat-value"><?php echo count_user_posts($user_id, 'tribe_events'); ?></span>
|
|
<span class="hvac-stat-label">Events Created</span>
|
|
</div>
|
|
<?php if (!empty($profile_meta['years_experience'])): ?>
|
|
<div class="hvac-stat-item">
|
|
<span class="hvac-stat-value"><?php echo esc_html($profile_meta['years_experience']); ?></span>
|
|
<span class="hvac-stat-label">Years Experience</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($coordinates): ?>
|
|
<div class="hvac-stat-item">
|
|
<span class="hvac-stat-value">📍</span>
|
|
<span class="hvac-stat-label">Location Verified</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hvac-profile-main">
|
|
<?php if (!empty($profile_meta['certification_status']) || !empty($profile_meta['certification_type']) || !empty($profile_meta['date_certified'])): ?>
|
|
<div class="hvac-profile-section hvac-certification-section">
|
|
<h2>Certification Information</h2>
|
|
<div class="hvac-profile-details">
|
|
<?php if (!empty($profile_meta['certification_status'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Certification Status:</span>
|
|
<span class="hvac-detail-value hvac-cert-status hvac-cert-status-<?php echo esc_attr(strtolower($profile_meta['certification_status'])); ?>">
|
|
<?php echo esc_html($profile_meta['certification_status']); ?>
|
|
</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['certification_type'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Certification Type:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['certification_type']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['date_certified'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Date Certified:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html(date('F j, Y', strtotime($profile_meta['date_certified']))); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="hvac-profile-section">
|
|
<h2>Personal Information</h2>
|
|
<div class="hvac-profile-details">
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Display Name:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['trainer_display_name'] ?? $user->display_name); ?></span>
|
|
</div>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Full Name:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html(($profile_meta['trainer_first_name'] ?? $user->first_name) . ' ' . ($profile_meta['trainer_last_name'] ?? $user->last_name)); ?></span>
|
|
</div>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Email:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($user->user_email); ?></span>
|
|
</div>
|
|
<?php if (!empty($profile_meta['role'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Role:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html(ucwords($profile_meta['role'])); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['years_experience'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Years Experience:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['years_experience']); ?> years</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php
|
|
$location_parts = array_filter([
|
|
$profile_meta['trainer_city'] ?? '',
|
|
$profile_meta['trainer_state'] ?? '',
|
|
$profile_meta['trainer_country'] ?? ''
|
|
]);
|
|
if (!empty($location_parts)):
|
|
?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Location:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html(implode(', ', $location_parts)); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['linkedin_profile_url'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">LinkedIn:</span>
|
|
<span class="hvac-detail-value">
|
|
<a href="<?php echo esc_url($profile_meta['linkedin_profile_url']); ?>" target="_blank">View Profile</a>
|
|
</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($profile->post_content)): ?>
|
|
<div class="hvac-profile-section">
|
|
<h2>About</h2>
|
|
<div class="hvac-profile-bio">
|
|
<?php echo wp_kses_post(wpautop($profile->post_content)); ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
// Get business type
|
|
$business_terms = get_the_terms($profile->ID, 'business_type');
|
|
$has_business_info = ($business_terms && !is_wp_error($business_terms)) ||
|
|
!empty($profile_meta['annual_revenue_target']) ||
|
|
!empty($profile_meta['application_details']);
|
|
if ($has_business_info):
|
|
?>
|
|
<div class="hvac-profile-section">
|
|
<h2>Business Information</h2>
|
|
<div class="hvac-profile-details">
|
|
<?php if ($business_terms && !is_wp_error($business_terms)): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Business Type:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($business_terms[0]->name); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['annual_revenue_target'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Annual Revenue Target:</span>
|
|
<span class="hvac-detail-value">$<?php echo esc_html(number_format($profile_meta['annual_revenue_target'])); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['application_details'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Application Details:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['application_details']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
// Training Information Section
|
|
$has_training_info = !empty($profile_meta['training_audience']) ||
|
|
!empty($profile_meta['training_formats']) ||
|
|
!empty($profile_meta['training_locations']) ||
|
|
!empty($profile_meta['training_resources']) ||
|
|
!empty($profile_meta['personal_accreditation']);
|
|
if ($has_training_info):
|
|
?>
|
|
<div class="hvac-profile-section">
|
|
<h2>Training Information</h2>
|
|
<div class="hvac-profile-details">
|
|
<?php if (!empty($profile_meta['training_audience'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Training Audience:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['training_audience']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['training_formats'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Training Formats:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['training_formats']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['training_locations'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Training Locations:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['training_locations']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['training_resources'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Training Resources:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['training_resources']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($profile_meta['personal_accreditation'])): ?>
|
|
<div class="hvac-detail-row">
|
|
<span class="hvac-detail-label">Personal Accreditation:</span>
|
|
<span class="hvac-detail-value"><?php echo esc_html($profile_meta['personal_accreditation']); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Share Profile Modal -->
|
|
<div id="hvac-share-profile-modal" class="hvac-share-modal" style="display: none;">
|
|
<div class="hvac-share-modal-content">
|
|
<!-- Close Button -->
|
|
<button class="hvac-modal-close" aria-label="Close">
|
|
<span class="dashicons dashicons-no"></span>
|
|
</button>
|
|
|
|
<!-- Modal Title -->
|
|
<h2 class="hvac-share-modal-title">Share Your Profile</h2>
|
|
|
|
<!-- Modal Description -->
|
|
<p class="hvac-share-description">
|
|
Get more training requests by sharing your trainer profile on your website, social media, or email!
|
|
</p>
|
|
|
|
<!-- Share URL Section -->
|
|
<div class="hvac-share-url-section">
|
|
<label for="hvac-share-url" class="hvac-share-url-label">
|
|
<strong>Your personal training profile link:</strong>
|
|
</label>
|
|
<div class="hvac-share-url-container">
|
|
<input type="text" id="hvac-share-url" class="hvac-share-url-input" readonly value="" placeholder="Loading...">
|
|
<button type="button" class="hvac-copy-url-btn" title="Copy to clipboard">
|
|
Copy
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Profile Card Section -->
|
|
<div class="hvac-share-card-section">
|
|
<p class="hvac-share-card-description">Or screenshot the image below!</p>
|
|
<div class="hvac-share-profile-card-container" id="hvac-share-card-container">
|
|
<!-- Profile card will be loaded here via AJAX -->
|
|
<div class="hvac-share-card-loading">
|
|
<span class="dashicons dashicons-update spin"></span>
|
|
<p>Loading profile card...</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// The CSS and JS are handled by the HVAC_Scripts_Styles class
|
|
// Additional localization for profile-specific data
|
|
if (class_exists('HVAC_Scripts_Styles')) {
|
|
$scripts_styles = HVAC_Scripts_Styles::instance();
|
|
$scripts_styles->localize_sharing_data([
|
|
'profile_id' => $profile->ID
|
|
]);
|
|
}
|
|
|
|
get_footer();
|