From 9d053f2b0f3b56124b90c8deed94ce2b1f8abfec Mon Sep 17 00:00:00 2001 From: bengizmo Date: Fri, 30 May 2025 09:20:13 -0600 Subject: [PATCH] fix: Remove shortcode override for tribe_community_events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HVAC plugin was overriding The Events Calendar Community Events shortcode with a custom implementation that displayed a non-functional form instead of the proper TEC Community Events form. This caused events to never be created when users submitted the form. Changes: - Removed add_shortcode('tribe_community_events', ...) override - Removed render_tribe_community_events() method - Removed render_event_submission_form() helper method The manage-event page now correctly uses The Events Calendar Community Events plugin shortcode, allowing proper event creation and submission. 🤖 Generated with Claude Code Co-Authored-By: Claude --- .../includes/class-hvac-community-events.php | 179 +----------------- 1 file changed, 5 insertions(+), 174 deletions(-) diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php index 89b73572..fe27ac05 100644 --- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php +++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php @@ -304,8 +304,8 @@ class HVAC_Community_Events { // Add certificate fix shortcode (admin only) add_shortcode('hvac_certificate_fix', array($this, 'render_certificate_fix')); - // Add community events shortcode as fallback if TEC CE is not available - add_shortcode('tribe_community_events', array($this, 'render_tribe_community_events')); + // Removed shortcode override - let The Events Calendar Community Events handle this shortcode + // add_shortcode('tribe_community_events', array($this, 'render_tribe_community_events')); // Add future shortcodes here } @@ -629,178 +629,9 @@ class HVAC_Community_Events { return $template; } // End load_custom_templates - /** - * Render tribe community events shortcode - */ - public function render_tribe_community_events($atts) { - // Parse shortcode attributes - $atts = shortcode_atts(array( - 'view' => 'submission_form' - ), $atts); - - // Check if user is logged in - if (!is_user_logged_in()) { - return '

Please log in to access this feature.

'; - } - - // Check if user has permission - if (!current_user_can('hvac_trainer') && !current_user_can('edit_posts')) { - return '
You do not have permission to access this feature.
'; - } - - // Check if TEC Community Events is active and working - if (class_exists('Tribe__Events__Community__Main')) { - // Check if the TEC shortcode handler exists - global $shortcode_tags; - $tec_handler = null; - - // Look for TEC's original handler - if (isset($shortcode_tags['tribe_community_events'])) { - $current_handler = $shortcode_tags['tribe_community_events']; - - // If it's our handler, temporarily remove it to find TEC's - if ($current_handler === array($this, 'render_tribe_community_events')) { - remove_shortcode('tribe_community_events'); - - // Try to get TEC's handler by calling their main class - if (class_exists('Tribe__Events__Community__Shortcodes')) { - $tec_shortcodes = new Tribe__Events__Community__Shortcodes(); - if (method_exists($tec_shortcodes, 'tribe_community_events')) { - $tec_handler = array($tec_shortcodes, 'tribe_community_events'); - } - } - - // If we found TEC's handler, use it - if ($tec_handler && is_callable($tec_handler)) { - $output = call_user_func($tec_handler, $atts); - - // Re-add our handler for next time - add_shortcode('tribe_community_events', array($this, 'render_tribe_community_events')); - - if (!empty($output) && !is_wp_error($output)) { - return $output; - } - } - - // Re-add our handler if TEC didn't work - add_shortcode('tribe_community_events', array($this, 'render_tribe_community_events')); - } - } - } - - // Handle different views - switch ($atts['view']) { - case 'submission_form': - return $this->render_event_submission_form(); - default: - return '
Unknown view: ' . esc_html($atts['view']) . '
'; - } - } - - /** - * Render event submission form - */ - private function render_event_submission_form() { - ob_start(); - ?> -
- -
-

Create New Training Event

- -
- -
- -
-

Notice: The Events Calendar Community Events plugin is not active. Using basic event creation form.

-

For full event management features, please contact your administrator to activate The Events Calendar Community Events plugin.

-
- -

Fill out the form below to create a new training event. All events are reviewed before being published.

-
- -
-

Instructions

-
    -
  • Provide a clear, descriptive title for your training event
  • -
  • Include detailed description of what attendees will learn
  • -
  • Set appropriate pricing for your target audience
  • -
  • Ensure venue information is accurate and complete
  • -
  • Events will be reviewed within 1-2 business days
  • -
-
- - - -
- - -
- - -
- -
- - -
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - Return to Dashboard -
-
-
-