/', '', $content);
$content = preg_replace('//', '', $content);
// Also strip any remaining HTML comments that might contain shortcode references
$content = preg_replace('//', '', $content);
// Clean up any extra whitespace
$content = trim($content);
// Process all shortcodes in the content
$processed_content = do_shortcode($content);
// Debug: Log if content changed
if (class_exists('HVAC_Logger') && $processed_content !== $content) {
HVAC_Logger::info('Content was processed by do_shortcode', 'ManageEvent');
}
// If shortcode wasn't processed (plugin might be inactive), show helpful message
if (strpos($processed_content, '[tribe_community_events') !== false) {
if (class_exists('HVAC_Logger')) {
HVAC_Logger::warning('tribe_community_events shortcode not processed - plugin may be inactive', 'ManageEvent');
}
$error_content = '
Event Submission Form Unavailable
The event submission form is currently unavailable. Please ensure:
- The Events Calendar plugin is active
- The Events Calendar Community Events add-on is active
- You are logged in as a trainer
Return to Dashboard
';
return $error_content;
}
// Return the processed content without wrapping
return $processed_content;
}
/**
* Add CSS styles for event form
*/
public function add_event_form_styles() {
// Check if we're on the manage page
$is_manage_page = false;
if (is_page('manage-event') || is_page('trainer-event-manage') || is_page(5334)) {
$is_manage_page = true;
}
$current_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
if ($current_path === 'trainer/event/manage' || $current_path === 'trainer/event/manage/') {
$is_manage_page = true;
}
if (!$is_manage_page) {
return;
}
echo '
';
}
/**
* Check authentication for manage-event page
*/
public function check_manage_event_auth() {
// Check if we're on the manage page using multiple methods
$is_manage_page = false;
// Method 1: Check by specific slugs
if (is_page('manage-event') || is_page('trainer-event-manage')) {
$is_manage_page = true;
}
// Method 2: Check by post ID
if (is_page(5334)) {
$is_manage_page = true;
}
// Method 3: Check by URL path
$current_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
if ($current_path === 'trainer/event/manage' || $current_path === 'trainer/event/manage/') {
$is_manage_page = true;
}
// Check if we're on the manage page (event creation page) and not logged in
if ($is_manage_page && !is_user_logged_in()) {
// Redirect to login page
wp_redirect(home_url('/training-login/?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])));
exit;
}
}
}