feat: Add clickable certificate links in Generate Certificates page
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
b9ecb37260
commit
3ea3135468
2 changed files with 52 additions and 3 deletions
|
|
@ -239,6 +239,25 @@
|
||||||
margin: 20px 0;
|
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 */
|
/* Stats cards */
|
||||||
.hvac-certificate-stats {
|
.hvac-certificate-stats {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,10 @@ try {
|
||||||
if (!empty($attendees) && class_exists('HVAC_Certificate_Manager')) {
|
if (!empty($attendees) && class_exists('HVAC_Certificate_Manager')) {
|
||||||
$certificate_manager = HVAC_Certificate_Manager::instance();
|
$certificate_manager = HVAC_Certificate_Manager::instance();
|
||||||
foreach ($attendees as $attendee) {
|
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();
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($has_certificate) : ?>
|
<?php if ($has_certificate && !empty($attendee->certificate_data)) : ?>
|
||||||
<span class="hvac-status-has-certificate">Certificate Issued</span>
|
<?php
|
||||||
|
// Generate secure download URL for the certificate
|
||||||
|
$certificate_url = '';
|
||||||
|
if (class_exists('HVAC_Certificate_Security')) {
|
||||||
|
$security = HVAC_Certificate_Security::instance();
|
||||||
|
$cert_data = array(
|
||||||
|
'file_path' => $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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php if ($certificate_url) : ?>
|
||||||
|
<a href="<?php echo esc_url($certificate_url); ?>"
|
||||||
|
target="_blank"
|
||||||
|
class="hvac-certificate-link hvac-status-has-certificate"
|
||||||
|
title="View certificate">
|
||||||
|
Certificate Issued
|
||||||
|
</a>
|
||||||
|
<?php else : ?>
|
||||||
|
<span class="hvac-status-has-certificate">Certificate Issued</span>
|
||||||
|
<?php endif; ?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<span class="hvac-status-no-certificate">No Certificate</span>
|
<span class="hvac-status-no-certificate">No Certificate</span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue