From: Chuck Scott Date: Mon, 27 Nov 2017 21:52:38 +0000 (-0500) Subject: Hook and html changes to support asking for event dates from registrations. X-Git-Tag: v1.6.77^2~27 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=55900ddeed55cffaa3c9eb76f0cdb6f9f9304faa;p=WP-Plugins%2Fglm-member-db-events.git Hook and html changes to support asking for event dates from registrations. --- diff --git a/setup/adminHooks.php b/setup/adminHooks.php index b9dcb50..97b7a0c 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -101,6 +101,52 @@ if ( $memberEventsAllowed ) { } +/* + * Add a filter to include a link to either create registrations for an event or to update that. + * If this is for a an event that has registrations setup, also provide some messages for edit + * and update pages for the event to let users know they have to update registrations if they + * change the dates or schedules. + */ +add_filter( + 'glm_members_add_link_to_registrations_event_list_entry', + function( $content ){ + + // Check if there's an existing reg_event record for the supplied event ID. + require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php'; + $Events = new GlmDataEvents($this->wpdb, $this->config); + + // If we were passed a valid Event ID + $eventId = $content-0; + if ($eventId > 0) { + + // Try to get get the registrations data for this event + $event = $Events->getEntry($eventId); + + // If we received valid registrations data for this event then it's already in registrations + if ($event) { + + // Return link title and URL for this event in registrations + return array( + 'title' => 'Event', + 'url' => GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE."events-list&option=edit&event=".$event['id'], + 'warning_title' => 'Dashboard for this Event', + 'edit_warning' => '', + 'update_warning' => '' + ); + + } + + } + + // Since we must not have had a good event ID + return false; + + }, + 10, + 2 + ); + + /* * Provide basic event data by Lat/Lon search for use as map items. * diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index fa7f4a3..03e2a7c 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -6,6 +6,11 @@ {if apply_filters('glm_members_permit_admin_member_event', true) && ($option == 'add' || $haveEvent)} + {$e_link = apply_filters('glm_members_add_link_to_event_list_entry', $event.fieldData.id)} + {if is_array($e_link)} + {$e_link.title} + {/if} + {if $haveMember} Return to Events List {else} @@ -29,7 +34,7 @@ {$e_link = apply_filters('glm_members_add_link_to_event_list_entry', $event.fieldData.id)} {if is_array($e_link) && $e_link.warning_title != false}
-
{if $option == 'edit'}{$e_link.edit_warning}{else}{$e_link.update_warning}{/if}

{$e_link.warning_title}

+
{if $option == 'edit'}{$e_link.edit_warning}{else}{$e_link.update_warning}{/if}
{/if} {/if}