fix: Ensure tribe_community_events shortcode is processed on manage-event page
- 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>
This commit is contained in:
parent
a7fc826064
commit
bf9a2125a3
2 changed files with 74 additions and 0 deletions
|
|
@ -58,6 +58,7 @@ class HVAC_Community_Events {
|
|||
'class-event-form-handler.php', // Add our form handler
|
||||
'class-event-author-fixer.php', // Fix event author assignment
|
||||
'class-hvac-dashboard.php', // New dashboard handler
|
||||
'class-hvac-manage-event.php', // Manage event page handler
|
||||
'certificates/class-certificate-installer.php', // Certificate database installer
|
||||
'certificates/class-certificate-manager.php', // Certificate management
|
||||
'certificates/class-certificate-generator.php', // Certificate generation
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
<?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();
|
||||
Loading…
Reference in a new issue