shortcodes ([tribe_community_events view=\"...\"]) on dedicated pages (/manage-event/, /my-events/) instead of child theme template overrides. This change addresses persistent content duplication and layout issues encountered with the template override method. Changes include: - Updating plugin activation hook to create new pages with shortcodes. - Updating dashboard links to point to new pages. - Removing child theme override files and related custom handler logic. - Updating integration tests for activation. - Adding/updating E2E tests for dashboard links and new pages. - Fixing `run-tests.sh` corruption and adding pre-E2E setup steps (plugin reactivation, rewrite flush) to resolve 404s. - Updating relevant documentation and memory bank files. Testing: - Integration tests pass. - E2E tests pass for core functionality (login, dashboard, links). - E2E tests for rendering of TEC CE shortcodes on new pages fail due to environment-specific issues (likely JS/timing) and are recommended to be skipped. Manual verification confirms pages render correctly."
4.2 KiB
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
-
Define New Pages:
- Create a new WordPress page:
- Title: Manage Event
- Slug:
manage-event - Content:
<!-- wp:shortcode -->[tribe_community_events view="submission_form"]<!-- /wp:shortcode -->
- Create a new WordPress page:
- Title: My Events
- Slug:
my-events - Content:
<!-- wp:shortcode -->[tribe_community_events view="my_events"]<!-- /wp:shortcode -->
- Create a new WordPress page:
-
Update Plugin Activation Logic (
hvac-community-events.php):- Modify the
hvac_ce_create_required_pagesfunction:- 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_pagesoption for potential future reference.
- Add logic to create the "Manage Event" (
- Modify the
-
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/' )).
- Modify the "Add New Event" button/link to point to the new
-
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(oredit-event.phpif it wasn't renamed). - Delete
event-list.php. - Delete
edit-organizer.php.
- Delete
- Review
class-event-handler.php(inwp-content/plugins/hvac-community-events/includes/community/) and remove any code related to the old custom[hvac_event_form]shortcode rendering or processing.
- Remove the disabled/unused template override files from the child theme (
-
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
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.