upskill-event-manager/templates/page-manage-event.php
Ben 71d25e2023 fix: correct TEC shortcode format for event editing form population
- Update includes/class-hvac-shortcodes.php:277 to use [tribe_community_events view="submission_form"]
- Update templates/page-manage-event.php:83 to use correct TEC shortcode format
- Fixes issue where event edit forms appeared blank instead of populated with existing data
- TEC submission_form view automatically detects event_id URL parameters for editing
- Enables proper event creation and editing functionality for trainers

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 19:42:30 -03:00

90 lines
2.6 KiB
PHP

<?php
/**
* Template Name: Manage Event
* Description: Template for managing events (uses The Events Calendar)
*/
// Define constant to indicate we are in a page template
define('HVAC_IN_PAGE_TEMPLATE', true);
get_header();
// The Events Calendar handles the event creation/editing interface
// This template ensures proper WordPress theme integration
?>
<style>
/* Hide duplicate headers and fix layout for event manage page */
.hvac-event-manage-wrapper .tribe-community-events #tribe-bar-form,
.hvac-event-manage-wrapper #tribe-bar-views,
.hvac-event-manage-wrapper .tribe-events-page-title {
display: none !important;
}
.hvac-event-manage-wrapper {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Fix The Events Calendar layout issues */
.hvac-event-manage-wrapper #tribe-community-events,
.hvac-event-manage-wrapper .tribe-community-events {
background: transparent !important;
border: none !important;
box-shadow: none !important;
margin-top: 0 !important;
}
/* Hide any duplicate site headers within the community events content */
.hvac-event-manage-wrapper .site-header,
.hvac-event-manage-wrapper .ast-header,
.hvac-event-manage-wrapper header {
display: none !important;
}
</style>
<div class="hvac-event-manage-wrapper">
<?php
// Display trainer navigation menu
if (class_exists('HVAC_Menu_System')) {
HVAC_Menu_System::instance()->render_trainer_menu();
}
?>
<div class="hvac-page-content">
<?php
// Let The Events Calendar handle the content
if (have_posts()) :
while (have_posts()) : the_post();
// Get the raw content and process it
global $post;
$raw_content = $post->post_content;
// Clean up any HTML comments
$patterns = [
'/<!--\s*wp:shortcode\s*-->/s',
'/<!--\s*\/wp:shortcode\s*-->/s',
'/<!--[^>]*wp:shortcode[^>]*-->/s',
'/<!--.*?-->/s'
];
foreach ($patterns as $pattern) {
$raw_content = preg_replace($pattern, '', $raw_content);
}
$raw_content = trim($raw_content);
// Process shortcodes
echo do_shortcode($raw_content);
endwhile;
else:
// Fallback - show the shortcode directly with submission form view
echo do_shortcode('[tribe_community_events view="submission_form"]');
endif;
?>
</div>
</div>
<?php
get_footer();