fix: Prevent event creation content from appearing on registration page

The manage event JavaScript was running on all pages and injecting "Create Event"
header and instructions into any page with matching content selectors. Added URL
path checking to ensure the JavaScript only runs on the actual manage event pages.

This fixes the issue where the registration page was showing event creation content
instead of just the registration form.

Co-Authored-By: Ben Reed <ben@tealmaker.com>
This commit is contained in:
bengizmo 2025-07-28 10:37:34 -03:00
parent 2cb37d0285
commit 2a0d2d2f7d

View file

@ -468,6 +468,19 @@ class HVAC_Manage_Event {
<script>
document.addEventListener("DOMContentLoaded", function() {
// Check if we are on the manage event page
var currentPath = window.location.pathname.replace(/\/$/, "");
var isManagePage = (
currentPath === "/trainer/event/manage" ||
currentPath === "/manage-event" ||
currentPath === "/trainer-event-manage"
);
// Only inject content on the manage event page
if (!isManagePage) {
return;
}
// Find the main content area
var contentArea = document.querySelector(".entry-content, .post-content, .page-content, main, .content");