From 3ea3135468901e046e46d997ac34fd9aed197710 Mon Sep 17 00:00:00 2001 From: bengizmo Date: Sat, 24 May 2025 09:33:20 -0300 Subject: [PATCH] feat: Add clickable certificate links in Generate Certificates page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modified template to fetch full certificate data instead of just boolean - Made "Certificate Issued" text clickable with secure download link - Links open in new tab for better user experience - Added CSS styling for certificate links with hover effects and external link indicator - Certificate URLs are generated with 1-hour validity for security 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../assets/css/hvac-certificates.css | 19 ++++++++++ .../template-generate-certificates.php | 36 +++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/assets/css/hvac-certificates.css b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/assets/css/hvac-certificates.css index b450719a..475f7575 100644 --- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/assets/css/hvac-certificates.css +++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/assets/css/hvac-certificates.css @@ -239,6 +239,25 @@ margin: 20px 0; } +/* Certificate link styling */ +.hvac-certificate-link { + color: #28a745; + text-decoration: none; + font-weight: 600; + transition: color 0.2s ease; +} + +.hvac-certificate-link:hover { + color: #218838; + text-decoration: underline; +} + +.hvac-certificate-link::after { + content: ' ↗'; + font-size: 0.8em; + vertical-align: super; +} + /* Stats cards */ .hvac-certificate-stats { display: grid; diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/certificates/template-generate-certificates.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/certificates/template-generate-certificates.php index 78f86d44..08a462c0 100644 --- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/certificates/template-generate-certificates.php +++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/certificates/template-generate-certificates.php @@ -76,7 +76,10 @@ try { if (!empty($attendees) && class_exists('HVAC_Certificate_Manager')) { $certificate_manager = HVAC_Certificate_Manager::instance(); foreach ($attendees as $attendee) { - $attendee->has_certificate = $certificate_manager->certificate_exists($event_id, $attendee->attendee_id); + // Get the actual certificate data, not just boolean + $certificate = $certificate_manager->get_certificate_by_attendee($event_id, $attendee->attendee_id); + $attendee->has_certificate = !empty($certificate); + $attendee->certificate_data = $certificate; } } @@ -218,8 +221,35 @@ get_header(); - - Certificate Issued + certificate_data)) : ?> + $attendee->certificate_data->file_path, + 'event_name' => $selected_event_title, + 'attendee_name' => $attendee_name, + 'certificate_id' => $attendee->certificate_data->certificate_id + ); + $certificate_url = $security->generate_download_token( + $attendee->certificate_data->certificate_id, + $cert_data, + 3600 // 1 hour validity + ); + } + ?> + + + Certificate Issued + + + Certificate Issued + No Certificate