From: Steve Sutton Date: Tue, 12 Feb 2019 17:24:44 +0000 (-0500) Subject: Updating shortcode to add region-search to list shortcode X-Git-Tag: v1.7.23^2~14 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=5e13aaca1d4a271cfd667233833811f6e28499c2;p=WP-Plugins%2Fglm-member-db-events.git Updating shortcode to add region-search to list shortcode Adding region-search to event list shortcode. --- diff --git a/classes/data/dataCategories.php b/classes/data/dataCategories.php index 50c1bde..abf7311 100644 --- a/classes/data/dataCategories.php +++ b/classes/data/dataCategories.php @@ -317,7 +317,7 @@ class GlmDataEventsCategories extends GlmDataAbstract $categoriesSorted = $this->sortParentChild($categories); if (!$forEdit) { - while (list($k, $v) = each($categoriesSorted)) { + foreach ( $categoriesSorted as $k => $v ) { $categoriesSorted[$k]['parent_id'] = $v['parent']['value']; $categoriesSorted[$k]['parent'] = $v['parent']['name']; } diff --git a/models/admin/events/list.php b/models/admin/events/list.php index 3aefba1..b153f8d 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -306,7 +306,7 @@ class GlmMembersAdmin_events_list extends GlmDataEvents $_REQUEST[$locID.'_event'] = $this->eventID; // Check for new cities in this location and if so use the new city real ID - if (isset($_REQEUST[$locID.'_city']) && $_REQUEST[$locID.'_city'][0] == 'n') { + if (isset($_REQUEST[$locID.'_city']) && $_REQUEST[$locID.'_city'][0] == 'n') { $_REQUEST[$locID.'_city'] = $newCityID[$_REQUEST[$locID.'_city']]; } @@ -501,10 +501,10 @@ class GlmMembersAdmin_events_list extends GlmDataEvents if (isset($_REQUEST['locID'])) { // For each location - while (list($id, $locID) = each($_REQUEST['locID'])) { + foreach ( $_REQUEST['locID'] $id => $locID ) { // Check for new cities in this location and if so use the new city real ID - if (isset($_REQEUST[$locID.'_city']) && $_REQUEST[$locID.'_city'][0] == 'n') { + if (isset($_REQUEST[$ocID.'_city']) && $_REQUEST[$locID.'_city'][0] == 'n') { $_REQUEST[$locID.'_city'] = $newCityID[$_REQUEST[$locID.'_city']]; } @@ -708,7 +708,7 @@ class GlmMembersAdmin_events_list extends GlmDataEvents // Add "selected" element default false; reset($categories); - while (list($k, $v) = each($categories)) { + foreach ( $categories $k => $v ) { $categories[$k]['selected'] = false; } @@ -1240,7 +1240,7 @@ class GlmMembersAdmin_events_list extends GlmDataEvents $Cities = new GlmDataCities($this->wpdb, $this->config); // For each new city submitted - while (list($k, $v) = each($_REQUEST['newCity'])) { + foreach ( $_REQUEST['newCity'] as $k => $v ) { $cName = trim(filter_var($_REQUEST['newCity'][$k])); diff --git a/models/front/events/frontAdd.php b/models/front/events/frontAdd.php index 4e4abcc..aaae766 100644 --- a/models/front/events/frontAdd.php +++ b/models/front/events/frontAdd.php @@ -133,7 +133,7 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents // Finally, move the files to the various size directories and rename them back to the correct name reset($this->config['imageSizes']); - while (list($k, $v) = each($this->config['imageSizes'])) { + foreach ( $this->config['imageSizes'] as $k => $v ) { // Check if size directory needs to be made if (!file_exists(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k)) { diff --git a/models/front/events/list.php b/models/front/events/list.php index 9e48028..adaa457 100644 --- a/models/front/events/list.php +++ b/models/front/events/list.php @@ -178,7 +178,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction } // Check for numeric IDs only - while (list($k, $v) = each($catsRequested)) { + foreach ( $catsRequested as $k => $v ) { // If it's just numeric - note Explode returns an array element with value = 0 if no string. if (preg_match('/^[0-9]*$/', trim($v)) && $v > 0) { @@ -194,6 +194,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction } + if ( isset( $_REQUEST['amenity'] ) && $amenityId = filter_var( $_REQUEST['amenity'], FILTER_VALIDATE_INT ) ) { $search = true; $action = 'event-list'; @@ -206,6 +207,10 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction $search = true; $action = 'event-list'; } + if ( isset( $actionData['request']['region-search'] ) && $regionId = filter_var( $actionData['request']['region-search'], FILTER_VALIDATE_INT ) ) { + $search = true; + $action = 'event-list'; + } if ( isset( $_REQUEST['venue'] ) && $venueId = filter_var( $_REQUEST['venue'], FILTER_VALIDATE_INT ) ) { $search = true; $action = 'event-list'; diff --git a/setup/shortcodes.php b/setup/shortcodes.php index ec0f7be..97181eb 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -99,17 +99,18 @@ $glmMembersEventsShortcodes = array( 'action' => 'list', 'table' => false, 'attributes' => array( - 'type' => 'all', - 'order' => 'title', - 'member' => false, - 'template' => false, - 'limit' => null, - 'featured' => null, - 'current' => null, - 'category' => null, - 'pageslug' => null, - 'group_by_day' => true, - 'group_month' => false, + 'type' => 'all', + 'order' => 'title', + 'member' => false, + 'template' => false, + 'limit' => null, + 'featured' => null, + 'current' => null, + 'category' => null, + 'region-search' => null, + 'pageslug' => null, + 'group_by_day' => true, + 'group_month' => false, 'show_all_in_agenda' => false, ) ), @@ -160,6 +161,17 @@ $glmMembersEventsShortcodesDescription = ' to display may be overridden by the "category-search" parameter. + +   + + region-search="{ region ID }" + + + The "region-search" attribute selects members who are listed in the specified + region. The region is specified by ID rather than name. This may be overridden by + a "region" URL parameter. + +