# Plan: Integrate TEC Community Events via Shortcodes **Date:** 2025-04-02 **Status:** Approved ## Goal Replace the problematic child theme template overrides for The Events Calendar: Community Events (TEC CE) pages (`edit-event.php`, `event-list.php`) with dedicated WordPress pages using the provided shortcodes. This aims to resolve duplication and layout issues encountered with the override method. ## Background Attempts to customize TEC CE pages using child theme template overrides resulted in persistent duplication of content (form rendering twice) and CSS layout conflicts (overlapping editor buttons, misplaced breadcrumbs). Debugging indicated the duplication issue occurred even without the override file active, suggesting a deeper conflict likely related to TEC CE's rendering process or hook interference. ## Relevant Shortcodes Based on TEC CE documentation, the following shortcodes will be used: * `[tribe_community_events view="submission_form"]`: Displays the form to submit a new event or edit an existing one. * `[tribe_community_events view="my_events"]`: Displays a list of events submitted by the currently logged-in user. ## Implementation Steps 1. **Define New Pages:** * Create a new WordPress page: * **Title:** Manage Event * **Slug:** `manage-event` * **Content:** `[tribe_community_events view="submission_form"]` * Create a new WordPress page: * **Title:** My Events * **Slug:** `my-events` * **Content:** `[tribe_community_events view="my_events"]` 2. **Update Plugin Activation Logic (`hvac-community-events.php`):** * Modify the `hvac_ce_create_required_pages` function: * Add logic to create the "Manage Event" (`manage-event`) page if it doesn't exist, setting its content as specified above. * Add logic to create the "My Events" (`my-events`) page if it doesn't exist, setting its content as specified above. * Ensure the previously removed `/submit-event/` page creation logic remains removed. * Store the IDs of these new pages in the `hvac_community_pages` option for potential future reference. 3. **Update Trainer Dashboard Links (`wp-content/plugins/hvac-community-events/templates/template-hvac-dashboard.php`):** * Modify the "Add New Event" button/link to point to the new `/manage-event/` page URL (`home_url( '/manage-event/' )`). * Modify the "View Your Submitted Events" button/link (or add one if missing) to point to the new `/my-events/` page URL (`home_url( '/my-events/' )`). 4. **Cleanup:** * Remove the disabled/unused template override files from the child theme (`wp-content/themes/upskill-hvac-astra-child/tribe-events/community/`): * Delete `edit-event.php.bak` (or `edit-event.php` if it wasn't renamed). * Delete `event-list.php`. * Delete `edit-organizer.php`. * Review `class-event-handler.php` (in `wp-content/plugins/hvac-community-events/includes/community/`) and remove any code related to the old custom `[hvac_event_form]` shortcode rendering or processing. 5. **Update Documentation & Memory Bank:** * **`docs/implementation_plan.md`**: Mark Task 6 (Template Customization) as abandoned/superseded. Add new sub-tasks for creating shortcode pages and updating dashboard links. * **`memory-bank/decisionLog.md`**: Add an entry explaining the decision to switch from template overrides to shortcodes. * **`memory-bank/activeContext.md`**: Update current focus to shortcode integration. * **`memory-bank/systemPatterns.md`**: Amend or remove the "Child Theme Template Overrides" pattern entry. ## Conceptual Flow Diagram ```mermaid graph TD A[Trainer Dashboard (/hvac-dashboard/)] -->|Clicks 'Add New Event'| B(Manage Event Page (/manage-event/)); A -->|Clicks 'My Events'| C(My Events Page (/my-events/)); B -- Contains --> D["[tribe_community_events view=\"submission_form\"]"]; C -- Contains --> E["[tribe_community_events view=\"my_events\"]"]; D -- Renders --> F(TEC CE Add/Edit Form); E -- Renders --> G(TEC CE User's Event List); G -->|Clicks 'Edit' on an event| B; ``` ## Next Steps Proceed with implementation in Code mode.