adding pageslug support for the events links in the calendar view
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 6 Jun 2017 18:08:02 +0000 (14:08 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 6 Jun 2017 18:08:02 +0000 (14:08 -0400)
checking to see if events list shortcode has a pageslug attribute and if so
use that page slug with the eventId query string param instead of the event slug.

models/admin/ajax/eventsCalMonthAJAX.php
views/front/events/agenda.html

index 01e6d09..c36ead5 100644 (file)
@@ -224,6 +224,11 @@ class GlmMembersAdmin_ajax_eventsCalMonthAJAX extends GlmDataEventsTimes
    // end section for front page events widget data
         } else if( isset($_REQUEST['month']) ){
 
+            if( isset( $_REQUEST['custom_page'] ) ){
+                $custom_page = $_REQUEST['custom_page'];
+            }
+            $page_slug = (isset($_REQUEST['page_slug']) ? filter_var( $_REQUEST['page_slug'], FILTER_SANITIZE_STRING ) : '');
+            
             $month = filter_var_array(
                 $_REQUEST['month'],
                 array(
@@ -263,7 +268,14 @@ class GlmMembersAdmin_ajax_eventsCalMonthAJAX extends GlmDataEventsTimes
                     $event_data[$e]['last'] = ($last);
                     $event_data[$e]['slug'] = $event_slugs[$e];
                     $slug = $event_slugs[$e];
-                    $event_data[$e]['url'] = GLM_MEMBERS_EVENTS_SITE_BASE_URL . "event-detail/" . $slug . "/";
+                    
+                    if($custom_page !== ''){
+                        $event_data[$e]['url'] = GLM_MEMBERS_EVENTS_SITE_BASE_URL . "$page_slug/?eventId=" . $val['event'];
+                        
+                    } else {
+                        $event_data[$e]['url'] = GLM_MEMBERS_EVENTS_SITE_BASE_URL . "$page_slug/" . $slug . "/";
+                    }
+                    
                 }
             }
         }
index 42badfd..6122417 100644 (file)
         var category            = $('#glm-event-category').val();
         var current_month       = $('{$current_month}');
         var current_year        = $('{$current_year}');
+        var custom_page         = '{$customPage}';
+        var page_slug           = '{$pageSlug}';
         var retain_date;
         
         if(!member_id){
                 glm_action: 'eventsCalMonthAJAX',
                 month: month,
                 category: category,
-                member_id: member_id
-
+                member_id: member_id,
+                custom_page: custom_page,
+                page_slug: page_slug
             };
             $('.fc-event').remove();
 
                 sessionStorage.current_calendar_view = get_current_view();
             
             
-                location.href = event.url + '?glm_event_from=' + event.start.format();
+                if(custom_page !== ''){
+                    location.href = event.url + '&glm_event_from=' + event.start.format();
+                } else {
+                    location.href = event.url + '?glm_event_from=' + event.start.format();
+                }
+                
                 return false;
             },
             eventLimit: true,