upskill-event-manager/templates/page-edit-event.php
ben 16acf2c8e7 docs: comprehensive deprecation of legacy event creation system
- Create authoritative DEPRECATED-FILES.md documenting 27+ deprecated files
- Add deprecation notices to legacy templates (page-create-event.php, page-manage-event.php, page-edit-event.php)
- Mark deprecated JavaScript files (hvac-event-form-templates.js) with migration paths
- Add deprecation notices to 8 legacy test files with comprehensive explanations
- Update Status.md to reflect completion of comprehensive event creation system v3.2.0
- Automated deprecation script for consistent messaging across files

All deprecated functionality has been replaced by:
- page-tec-create-event.php with AI assistance and native TEC integration
- Comprehensive E2E testing framework with Page Object Model
- Integrated template system with enhanced user experience
- Modern responsive design with role-based permissions

Scheduled for removal in v3.3 after transition period

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 20:55:13 -03:00

180 lines
No EOL
6.3 KiB
PHP

<?php
/**
* Template Name: Edit Event
* Description: Template for editing existing events with REST API (100% field control)
*
* ⛔ DEPRECATED - January 2025
* This template has been deprecated and replaced by page-tec-edit-event.php
*
* Reasons for deprecation:
* - Legacy REST API approach replaced by native TEC integration
* - Improved TEC integration in newer template
* - Enhanced user experience with modern UI
* - Better error handling and validation
* - Consistent with new event creation system
*
* Replacement: templates/page-tec-edit-event.php
* - Native TEC integration with full compatibility
* - Enhanced form validation and user feedback
* - Consistent styling with create event page
* - Improved accessibility and responsive design
*
* See: DEPRECATED-FILES.md for full migration details
*/
// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);
// Force output early to ensure template is working
echo '<!-- HVAC EDIT EVENT TEMPLATE LOADED -->';
get_header();
// Get event ID from URL
$event_id = isset($_GET['event_id']) ? intval($_GET['event_id']) : 0;
?>
<style>
.hvac-edit-event-wrapper {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.hvac-edit-event-wrapper h1 {
color: #1a1a1a;
font-size: 28px;
margin-bottom: 20px;
}
.hvac-form-notice {
background: #f0f7ff;
border: 1px solid #0073aa;
border-radius: 4px;
padding: 12px;
margin-bottom: 20px;
}
.hvac-form-notice p {
margin: 0;
color: #0073aa;
}
.hvac-error-notice {
background: #fff5f5;
border: 1px solid #dc3232;
border-radius: 4px;
padding: 12px;
margin-bottom: 20px;
}
.hvac-error-notice p {
margin: 0;
color: #dc3232;
}
</style>
<div class="hvac-edit-event-wrapper">
<?php
// Display trainer navigation menu and breadcrumbs
if (class_exists('HVAC_Menu_System')) {
echo '<div class="hvac-navigation-wrapper">';
HVAC_Menu_System::instance()->render_trainer_menu();
echo '</div>';
}
// Display breadcrumbs
if (class_exists('HVAC_Breadcrumbs')) {
echo '<div class="hvac-breadcrumbs-wrapper">';
echo HVAC_Breadcrumbs::instance()->render_breadcrumbs();
echo '</div>';
}
?>
<h1>Edit Event</h1>
<?php
// Debug output removed for security - no unescaped user input in HTML comments
if (defined('WP_DEBUG') && WP_DEBUG && current_user_can('manage_options')) {
echo '<!-- DEBUG: event_id = ' . absint($event_id) . ' -->';
}
?>
<?php if ($event_id > 0) : ?>
<div class="hvac-form-notice">
<p>Editing Event ID: <?php echo esc_html($event_id); ?> - Full control over all fields including excerpt.</p>
</div>
<div class="hvac-page-content">
<?php
// Debug TEC shortcode
echo '<!-- DEBUG: About to render TEC shortcode -->';
// Check if TEC Community Events is active
if (function_exists('tribe_community_events_init')) {
echo '<!-- DEBUG: TEC Community Events function exists -->';
// Render the TEC edit form with the event ID
$shortcode_output = do_shortcode('[tribe_community_events view="edit_event" id="' . $event_id . '"]');
echo '<!-- DEBUG: Shortcode output length: ' . strlen($shortcode_output) . ' -->';
echo $shortcode_output;
} else {
echo '<!-- DEBUG: TEC Community Events function NOT found -->';
echo '<div class="hvac-error-notice"><p>The Events Calendar Community Events plugin is required but not active.</p></div>';
}
?>
</div>
<script>
// Inline script to ensure REST API enhancement loads for editing
jQuery(document).ready(function($) {
console.log('[Edit Event Page] Initializing REST API enhancement for event <?php echo $event_id; ?>...');
// Store event ID for REST API to use
window.hvacEditEventId = <?php echo $event_id; ?>;
console.log('[Edit Event Page] Set window.hvacEditEventId =', window.hvacEditEventId);
// DISABLED: REST API form override disabled to allow TEC native form handling
// This was causing 500 "Security check failed" errors by intercepting form submission
// and bypassing WordPress/TEC security token validation
/*
// Wait a bit for the page to fully load before checking for REST API
setTimeout(function() {
// Check if REST API script is loaded
if (typeof HVACRestEventSubmission !== 'undefined') {
console.log('[Edit Event Page] REST API script already loaded');
// Re-initialize for edit mode
HVACRestEventSubmission.init();
} else {
console.log('[Edit Event Page] Loading REST API script...');
// Dynamically load the REST API script if not already loaded
$.getScript('<?php echo HVAC_PLUGIN_URL; ?>assets/js/hvac-rest-api-event-submission.js')
.done(function() {
console.log('[Edit Event Page] REST API script loaded successfully');
if (typeof HVACRestEventSubmission !== 'undefined') {
HVACRestEventSubmission.init();
console.log('[Edit Event Page] REST API initialized for edit mode');
}
})
.fail(function() {
console.error('[Edit Event Page] Failed to load REST API script');
});
}
}, 1000);
*/
console.log('[Edit Event Page] Using TEC native form handling - REST API override disabled');
});
</script>
<?php else : ?>
<div class="hvac-error-notice">
<p>No event specified. Please select an event to edit.</p>
</div>
<div class="hvac-page-content">
<p><a href="<?php echo esc_url(home_url('/trainer/event/manage/')); ?>" class="button">Back to Event Management</a></p>
</div>
<?php endif; ?>
</div>
<?php
get_footer();
?>