Adding attribute for event list (pageslug)
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 28 Apr 2017 20:12:29 +0000 (16:12 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 28 Apr 2017 20:12:29 +0000 (16:12 -0400)
This will be used to allow for a custom event list page that has their
own event detail page.
TODO: Need to work on getting this to work with populating the page
title. Also the url won't have the event name slug in it.

models/front/events/list.php
setup/frontHooks.php
setup/shortcodes.php
views/front/events/agenda.html

index 34ffd0e..df02a4a 100644 (file)
@@ -67,7 +67,14 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
         $venueId      = null;
         $eventDays    = array();
         $eventDay     = null;
+        $pageSlug     = 'event-detail';
+        $customPage   = false;
 
+        // If there's a pageslug as attribute then update the pageSlug
+        if ( isset ( $actionData['request']['pageslug'] ) ) {
+            $pageSlug   = $actionData['request']['pageslug'];
+            $customPage = true;
+        }
         // If a memberID has been specified, limit to that member
         if ( isset( $actionData['request']['member'] ) ) {
             $memberId = $actionData['request']['member'] - 0;
@@ -779,6 +786,8 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
             'imgUrl'       => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/',
             'calDates'     => $calDates,
             'cal_view'     => $calendar_view,
+            'pageSlug'     => $pageSlug,
+            'customPage'   => $customPage,
 //            'override'     => $override_default_view
         );
         error_reporting(E_ALL ^ E_NOTICE);
index db648e1..b9e1399 100644 (file)
@@ -60,7 +60,7 @@ add_action('wp_loaded', function() {
  *
  * We're also going to set the page title to the event name in here while we're at it.
  */
-if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, $this->config['settings']['canonical_event_page']) > 0) {
+if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, '/'.$this->config['settings']['canonical_event_page']).'/' > 0) {
 
     // Parse out only the event slug from the current URL
     $m = array();
index beaf407..b30a021 100644 (file)
@@ -107,6 +107,7 @@ $glmMembersEventsShortcodes = array(
             'featured' => null,
             'current'  => null,
             'category' => null,
+            'pageslug' => null,
         )
     ),
     'glm-members-event-detail' => array(
index b6243cc..896e19e 100644 (file)
@@ -80,7 +80,7 @@
                                         {if $event.image}<img style="float:right;" src="{$imgUrl}{$event.image}">{/if}
                                         {$event.intro}
                                         <div>
-                                            <a class="glm-read-more" href="{$siteBaseUrl}event-detail/{$event.name_slug}/">Read More</a>
+                                            <a class="glm-read-more" href="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">Read More</a>
                                         </div>
                                     </div>
                                 </div>