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
// 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 = "<td><a href='#'>Link for registration for event " . $result . "</a></td>";
+ if($result){
+ $return = "<td><a href='$admin_page&option=edit®istration_ID=$result'>Edit Registration</a></td>";
+
+ } else {
+ $return = "<td><a href='$admin_page&option=add'>Add Registration</a></td>";
+ }
return $return;
},