- Added HVAC_Manage_Event class to handle shortcode processing - Ensures do_shortcode() is explicitly called for the page content - Shows helpful message if TEC Community Events plugin is not active - Adds authentication check for the manage-event page This fixes the issue where the raw shortcode was being displayed instead of the event submission form. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
73 lines
No EOL
2.3 KiB
PHP
73 lines
No EOL
2.3 KiB
PHP
<?php
|
|
/**
|
|
* HVAC Manage Event Handler
|
|
*
|
|
* Ensures proper shortcode processing for the manage-event page
|
|
*
|
|
* @package HVAC_Community_Events
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class HVAC_Manage_Event {
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct() {
|
|
// Hook into content filter with high priority to ensure shortcode processing
|
|
add_filter('the_content', array($this, 'ensure_shortcode_processing'), 1);
|
|
|
|
// Add authentication check for manage-event page
|
|
add_action('template_redirect', array($this, 'check_manage_event_auth'));
|
|
}
|
|
|
|
/**
|
|
* Ensure shortcode processing for manage-event page
|
|
*/
|
|
public function ensure_shortcode_processing($content) {
|
|
// Only process on manage-event page
|
|
if (!is_page('manage-event')) {
|
|
return $content;
|
|
}
|
|
|
|
// Check if content contains the tribe_community_events shortcode
|
|
if (has_shortcode($content, 'tribe_community_events')) {
|
|
// Process shortcodes explicitly
|
|
$content = do_shortcode($content);
|
|
}
|
|
|
|
// If shortcode wasn't processed (plugin might be inactive), show helpful message
|
|
if (strpos($content, '[tribe_community_events') !== false) {
|
|
$content = '<div class="hvac-notice">
|
|
<p>The event submission form is currently unavailable. Please ensure:</p>
|
|
<ul>
|
|
<li>The Events Calendar plugin is active</li>
|
|
<li>The Events Calendar Community Events add-on is active</li>
|
|
<li>You are logged in as a trainer</li>
|
|
</ul>
|
|
<p><a href="' . esc_url(home_url('/hvac-dashboard/')) . '" class="button">Return to Dashboard</a></p>
|
|
</div>';
|
|
}
|
|
|
|
return $content;
|
|
}
|
|
|
|
/**
|
|
* Check authentication for manage-event page
|
|
*/
|
|
public function check_manage_event_auth() {
|
|
// Check if we're on the manage-event page
|
|
if (is_page('manage-event') && !is_user_logged_in()) {
|
|
// Redirect to login page
|
|
wp_redirect(home_url('/community-login/?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])));
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Initialize the manage event handler
|
|
new HVAC_Manage_Event(); |