fix: publish toggle error alert and event visibility

- Add proper error handling to toggle_event_published.php with HTTP status codes
- Add try-catch block for database operations in toggle endpoint
- Update events.php query to only show published events (added published = 1 filter)
- Add updated_at timestamp update when toggling publish status
- Improve error messages for better debugging
This commit is contained in:
twotalesanimation
2025-12-04 21:56:57 +02:00
parent f522b84fc1
commit 32651ed433
2 changed files with 46 additions and 29 deletions

View File

@@ -90,8 +90,8 @@ include_once($rootPath . '/header.php');
</div>
<?php
// Query to retrieve upcoming events
$stmt = $conn->prepare("SELECT event_id, date, time, name, image, description, feature, location, type, promo FROM events WHERE date > CURDATE() ORDER BY date ASC");
// Query to retrieve upcoming published events only
$stmt = $conn->prepare("SELECT event_id, date, time, name, image, description, feature, location, type, promo FROM events WHERE date > CURDATE() AND published = 1 ORDER BY date ASC");
$stmt->execute();
$result = $stmt->get_result();