Starting work for adding page for category slugs
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Jan 2017 21:53:29 +0000 (16:53 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 20 Jan 2017 21:53:29 +0000 (16:53 -0500)
Need to add to the database tables also.
New field for the categories of name_slug.
Will need to be setup like the event name_slug field.

models/front/events/list.php
setup/frontHooks.php
setup/shortcodes.php

index 27284eb..e1ab202 100644 (file)
@@ -66,6 +66,18 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
         $eventDays    = array();
         $eventDay     = null;
 
+
+        // Test to see if there's an event cat slug
+        $eventCatSlug = get_query_var( 'eventcatslug' );
+        if ( $eventCatSlug ) {
+            $sql = "
+            SELECT id
+              FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories
+             WHERE name_slug = '$eventCatSlug'";
+            //$categoryId = $this->wpdb->get_var( $sql );
+        }
+        var_dump( $eventCatSlug );
+
         // If a memberID has been specified, limit to that member
         if ( isset( $actionData['request']['member'] ) ) {
             $memberId = $actionData['request']['member'] - 0;
index 4fce8c7..4982bd8 100644 (file)
  *  *** Also note that parameters will be in the context of the main front controller constructor. ***
  */
 
-// Setup rewrite for package detail page
+// Setup rewrite for event detail page
 add_filter( 'rewrite_rules_array', function($rules) {
     $newrules = array();
     $newrules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&eventslug=$matches[2]';
     return $newrules + $rules;
 });
+add_filter( 'rewrite_rules_array', function($rules) {
+    $newrules = array();
+    $newrules['(event-cat)/([^/]*)$']='index.php?pagename=$matches[1]&eventcatslug=$matches[2]';
+    return $newrules + $rules;
+});
 add_filter( 'query_vars', function($vars) {
     array_push($vars, 'eventslug');
     return $vars;
 });
+add_filter( 'query_vars', function($vars) {
+    array_push($vars, 'eventcatslug');
+    return $vars;
+});
 add_action('wp_loaded', function() {
     $rules = get_option('rewrite_rules');
     if ( ! isset( $rules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$'] ) ) {
@@ -104,10 +113,10 @@ if (strpos(GLM_MEMBERS_PLUGIN_CURRENT_URL, $this->config['settings']['canonical_
 }
 
 // Add eventslug query var
-add_filter('query_vars', function($vars) {
-    array_push($vars, 'eventslug');
-    return $vars;
-});
+//add_filter('query_vars', function($vars) {
+//    array_push($vars, 'eventslug');
+//    return $vars;
+//});
 
 if (isset($this->config['addOns']['glm-member-db'])) {
 
index d209d5e..f2c3dcd 100644 (file)
@@ -117,7 +117,22 @@ $glmMembersEventsShortcodes = array(
             'id'       => false,
             'template' => false,
         )
-
+    ),
+    'glm-members-event-category' => array(
+        'plugin'     => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+        'menu'       => 'events',
+        'action'     => 'list',
+        'table'      => false,
+        'attributes' => array(
+            'catname'  => null,
+            'type'     => 'all',
+            'order'    => 'title',
+            'member'   => false,
+            'template' => false,
+            'limit'    => null,
+            'featured' => null,
+            'current'  => null,
+        ),
     ),
     'glm-members-event-front-add' => array(
         'plugin'     => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,