Added test fix for intermittant event detail pages. hotfix/1.3.2
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 30 Aug 2016 16:27:56 +0000 (12:27 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 30 Aug 2016 16:27:56 +0000 (12:27 -0400)
index.php
setup/frontHooks.php

index d40a3b1..daa3705 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database Events
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.3.1
+ * Version: 1.3.2
  * Author: Chuck Scott
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -20,7 +20,7 @@
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.3.1
+ * @version 1.3.2
  */
 
 /*
@@ -38,7 +38,7 @@
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.3.1');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.3.2');
 define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.20');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 205dd5a..c40c2f7 100644 (file)
  *  *** Also note that parameters will be in the context of the main front controller constructor. ***
  */
 
+// Setup rewrite for member detail pages
+add_filter('rewrite_rules_array', function($rules) {
+
+    // Check if rule is not set
+    if ( ! isset( $rules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$'] ) ) {
+
+        // Add the new rule
+        $newrules = array();
+        $newrules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&eventslug=$matches[2]';
+        return $newrules + $rules;
+    }
+
+    // If already set, just return the rules unchanged.
+    return $rules;
+
+});
+
+/* This code is being replace for testing by the above to avoid intermittent 404's on the detail pages.
 // Check if the canonical event page rewrite rule is not currently in place.
 $rules = get_option( 'rewrite_rules' );
 if ( ! isset( $rules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$'] ) ) {
@@ -44,6 +62,7 @@ if ( ! isset( $rules['('.$this->config['settings']['canonical_event_page'].')/([
     });
 
 }
+*/
 
 /*
  * Event Detail Page Canonical URL Fix