From 4f686c1eca414aa868f56b0fe2008dfaf1876bfe Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 19 May 2017 16:44:28 -0400 Subject: [PATCH] setting the registration url in events list based on the query results of reg_event if an event has a registration record attached to it, it will have an edit url otherwise it will have an add url. For the link next to the events in the events list admin view --- setup/adminHooks.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 6bde7c0..aec1dcd 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -66,9 +66,15 @@ add_filter( // Check if there's an existing reg_event record for the supplied event ID. require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; $sql = "SELECT id FROM " .GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event WHERE event='".$eventId."';"; - $result = $this->wpdb->query($sql); + $result = $this->wpdb->get_var($sql); + $admin_page = GLM_MEMBERS_REGISTRATIONS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-registrations-events'; - $return = "Link for registration for event " . $result . ""; + if($result){ + $return = "Edit Registration"; + + } else { + $return = "Add Registration"; + } return $return; }, -- 2.17.1