upskill-event-manager/includes/helpers/attendee-profile-link.php
bengizmo 37f4180e1c feat: Add massive missing plugin infrastructure to repository
🚨 CRITICAL: Fixed deployment blockers by adding missing core directories:

**Community System (CRITICAL)**
- includes/community/ - Login_Handler and all community classes
- templates/community/ - Community login forms

**Certificate System (CRITICAL)**
- includes/certificates/ - 8+ certificate classes and handlers
- templates/certificates/ - Certificate reports and generation templates

**Core Individual Classes (CRITICAL)**
- includes/class-hvac-event-summary.php
- includes/class-hvac-trainer-profile-manager.php
- includes/class-hvac-master-dashboard-data.php
- Plus 40+ other individual HVAC classes

**Major Feature Systems (HIGH)**
- includes/database/ - Training leads database tables
- includes/find-trainer/ - Find trainer directory and MapGeo integration
- includes/google-sheets/ - Google Sheets integration system
- includes/zoho/ - Complete Zoho CRM integration
- includes/communication/ - Communication templates system

**Template Infrastructure**
- templates/attendee/, templates/email-attendees/
- templates/event-summary/, templates/status/
- templates/template-parts/ - Shared template components

**Impact:**
- 70+ files added covering 10+ missing directories
- Resolves ALL deployment blockers and feature breakdowns
- Plugin activation should now work correctly
- Multi-machine deployment fully supported

🔧 Generated with Claude Code

Co-Authored-By: Ben Reed <ben@tealmaker.com>
2025-08-11 13:30:11 -03:00

150 lines
No EOL
4.1 KiB
PHP

<?php
/**
* Helper function to generate attendee profile links
*
* @package HVAC_Community_Events
* @since 1.0.0
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
/**
* Generate a link to view an attendee's profile
*
* @param int|object $attendee Attendee ID or attendee object
* @param string $link_text Optional custom link text
* @param array $classes Optional CSS classes
* @return string HTML link to attendee profile
*/
function hvac_get_attendee_profile_link($attendee, $link_text = '', $classes = array()) {
// Get attendee ID
$attendee_id = 0;
if (is_object($attendee)) {
$attendee_id = isset($attendee->attendee_id) ? $attendee->attendee_id :
(isset($attendee->ID) ? $attendee->ID : 0);
} else {
$attendee_id = intval($attendee);
}
if (!$attendee_id) {
return '';
}
// Get profile page URL
$profile_page = get_page_by_path('attendee-profile');
if (!$profile_page) {
return '';
}
$profile_url = add_query_arg('attendee_id', $attendee_id, get_permalink($profile_page->ID));
// Default link text
if (empty($link_text)) {
$link_text = __('View Profile', 'hvac-community-events');
}
// Build classes
$class_list = array('hvac-attendee-profile-link');
if (!empty($classes)) {
$class_list = array_merge($class_list, (array)$classes);
}
// Generate link
return sprintf(
'<a href="%s" class="%s" target="_blank" title="%s">%s <i class="fas fa-external-link-alt"></i></a>',
esc_url($profile_url),
esc_attr(implode(' ', $class_list)),
esc_attr__('View attendee profile', 'hvac-community-events'),
esc_html($link_text)
);
}
/**
* Generate a small icon link to view an attendee's profile
*
* @param int|object $attendee Attendee ID or attendee object
* @return string HTML icon link to attendee profile
*/
function hvac_get_attendee_profile_icon($attendee) {
// Get attendee ID
$attendee_id = 0;
if (is_object($attendee)) {
$attendee_id = isset($attendee->attendee_id) ? $attendee->attendee_id :
(isset($attendee->ID) ? $attendee->ID : 0);
} else {
$attendee_id = intval($attendee);
}
if (!$attendee_id) {
return '';
}
// Get profile page URL
$profile_page = get_page_by_path('attendee-profile');
if (!$profile_page) {
return '';
}
$profile_url = add_query_arg('attendee_id', $attendee_id, get_permalink($profile_page->ID));
// Generate icon link
return sprintf(
'<a href="%s" class="hvac-attendee-profile-icon" target="_blank" title="%s"><i class="fas fa-user-circle"></i></a>',
esc_url($profile_url),
esc_attr__('View attendee profile', 'hvac-community-events')
);
}
/**
* Add profile link styles to pages that show attendee lists
*/
function hvac_attendee_profile_link_styles() {
?>
<style>
.hvac-attendee-profile-link {
color: #007cba;
text-decoration: none;
font-size: 14px;
display: inline-flex;
align-items: center;
gap: 5px;
}
.hvac-attendee-profile-link:hover {
text-decoration: underline;
}
.hvac-attendee-profile-link i {
font-size: 12px;
opacity: 0.7;
}
.hvac-attendee-profile-icon {
color: #007cba;
font-size: 18px;
text-decoration: none;
display: inline-block;
padding: 2px;
transition: color 0.2s ease;
}
.hvac-attendee-profile-icon:hover {
color: #005a87;
}
/* Add to table cells */
.hvac-attendee-name-cell {
display: flex;
align-items: center;
gap: 10px;
}
</style>
<?php
}
// Add styles to relevant pages
add_action('wp_head', function() {
if (is_page(array('hvac-dashboard', 'event-summary', 'certificate-reports', 'generate-certificates', 'email-attendees'))) {
hvac_attendee_profile_link_styles();
}
});