From: Chuck Scott Date: Fri, 2 Sep 2016 14:32:40 +0000 (-0400) Subject: Fixed a few undefined references. X-Git-Tag: v1.3.5^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2e398bf0ea9beec931a2e0af2a69652ced21bae7;p=WP-Plugins%2Fglm-member-db-events.git Fixed a few undefined references. Updated the rewrite rules flush for event detail pages again. --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index c40c2f7..acd4639 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -26,43 +26,24 @@ * *** 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; - +// Setup rewrite for package 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; }); - -/* 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'].')/([^/]*)$'] ) ) { - - // Setup rewrite for member detail pages - 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; - }); - - // Rewrite is not in place, so setup init call to add it and flush the rewrite cache - add_filter('init', function() { +add_filter( 'query_vars', function($vars) { + array_push($vars, 'eventslug'); + return $vars; +}); +add_action('wp_loaded', function() { + $rules = get_option('rewrite_rules'); + if ( ! isset( $rules['('.$this->config['settings']['canonical_event_page'].')/([^/]*)$'] ) ) { + trigger_error('Doing rewrite flush - Event detail page', E_USER_NOTICE); // Logging that this is happening so we can track when that happens. global $wp_rewrite; $wp_rewrite->flush_rules(); - }); - -} -*/ + } +}); /* * Event Detail Page Canonical URL Fix diff --git a/views/admin/management/events.html b/views/admin/management/events.html index 928bde4..f34bd8c 100644 --- a/views/admin/management/events.html +++ b/views/admin/management/events.html @@ -307,10 +307,6 @@ var table = $(this).attr('data-show-table'); $('#' + table).removeClass('glm-hidden'); - if (table == 'glm-table-address') { - initMap(); - } - }); // Flash certain elements for a short time after display