From: Steve Sutton Date: Fri, 17 Jun 2016 17:48:32 +0000 (-0400) Subject: Updating shortcode section and the search form X-Git-Tag: v2.1.12~9 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e5cde92b7d30ab8f3c4af4441cb4d1f538108cfe;p=WP-Plugins%2Fglm-member-db.git Updating shortcode section and the search form On search form I'm adding in the filter for the groups if in shortcode and the amenity in groups that are searchable. --- diff --git a/models/front/members/list.php b/models/front/members/list.php index 1fb156bd..80caa864 100644 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -148,15 +148,15 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo public function modelAction ($actionData = false) { - $where = ''; - $whereSep = ''; - $filterPending = false; + $where = ''; + $whereSep = ''; + $filterPending = false; $filterArchived = false; - $filterName = false; - $haveFilter = false; - $textSearch = ''; - $blankStart = false; - $membersFound = false; + $filterName = false; + $haveFilter = false; + $textSearch = ''; + $blankStart = false; + $membersFound = false; // Check for "show" shortcode parameter (what elements to show on the page) $settings = array(); @@ -371,16 +371,33 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // Get amenity filter data $amenityData = false; $amenSelected = ''; - if ($this->config['settings']['list_show_search_amenities']) { + if ( $this->config['settings']['list_show_search_amenities'] ) { // Get amenity data for search pick list - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); - $Amenities = new GlmDataAmenities($this->wpdb, $this->config); - $amenityData = $Amenities->getList('T.ref_type = '.$this->config['ref_type_numb']['MemberInfo']); + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'; + $Amenities = new GlmDataAmenities($this->wpdb, $this->config); + $amenity_sql = + "T.ref_type = {$this->config['ref_type_numb']['MemberInfo']} + AND T.id IN ( + SELECT amenity_id + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "grouped_amenities + WHERE searchable <> false"; + // check to see if there are groups in shortcode + if ( $actionData['request']['amenity-groups'] ) { + $groups = explode( ',', $actionData['request']['amenity-groups'] ); + $f_groups = array_filter( $groups, 'is_numeric' ); + if ( !empty( $f_groups ) ) { + $amenity_sql .= " AND group_id IN ( " . implode( ',', $f_groups ) ." ) "; + } + } + $amenity_sql .= ")"; + $amenityData = $Amenities->getList( $amenity_sql ); // Add default flag as false to all entries - foreach ($amenityData as $k=>$v) { - $amenityData[$k]['default'] = false; + if ( !empty( $amenityData ) ) { + foreach ($amenityData as $k=>$v) { + $amenityData[$k]['default'] = false; + } } // Check if an amenity has been submitted diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 2aea27af..f74cbbf3 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -64,104 +64,105 @@ $glmMembersShortcodes = array( 'glm-members-list' => array( - 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, - 'menu' => 'members', - 'action' => 'list', - 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'list', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', 'attributes' => array( - 'category' => false, - 'category-name' => false, - 'blank-start' => false, - 'show' => false, - 'view' => false, - 'map' => 'list_show_map', - 'map-opened' => 'list_map_show_opened', - 'map-name-link' => 'list_map_show_detaillink', - 'map-logo' => 'list_map_show_logo', - 'map-description' => 'list_map_show_descr', - 'map-short-description' => 'list_map_show_short_descr', - 'map-address' => 'list_map_show_address', - 'map-street' => 'list_map_show_street', - 'map-city-state-zip' => 'list_map_show_citystatezip', - 'map-country' => 'list_map_show_country', - 'map-region' => 'list_map_show_region', - 'map-phone' => 'list_map_show_phone', - 'map-toll-free' => 'list_map_show_tollfree', - 'map-url' => 'list_map_show_url', - 'map-url-new-target' => 'list_map_show_url_newtarget', - 'map-email' => 'list_map_show_email', - 'map-categories' => 'list_map_show_categories', - 'map-credit-cards' => 'list_map_show_creditcards', - 'map-amentities' => 'list_map_show_amenities', - 'search' => 'list_show_search', - 'search-filters-opened' => 'list_show_search_filters_opened', - 'search-text' => 'list_show_search_text', - 'search-categories' => 'list_show_search_category', - 'search-amenities' => 'list_show_search_amenities', - 'search-alpha' => 'list_show_search_alpha', - 'list' => 'list_show_list', - 'name-link' => 'list_show_detail_link', - 'logo' => 'list_show_logo', - 'address' => 'list_show_address', - 'street' => 'list_show_street', - 'city-state-zip' => 'list_show_citystatezip', - 'country' => 'list_show_country', - 'region' => 'list_show_region', - 'description' => 'list_show_descr', - 'short-description' => 'list_show_short_descr', - 'phone' => 'list_show_phone', - 'toll-free' => 'list_show_tollfree', - 'url' => 'list_show_url', - 'url-new-target' => 'list_show_url_newtarget', - 'email' => 'list_show_email', - 'categories' => 'list_show_categroies', - 'credit-cards' => 'list_show_creditcards', - 'amentities' => 'list_show_amenities', - 'packages' => 'list_show_packages', - 'packages-link' => 'list_show_packages_link' + 'category' => false, + 'category-name' => false, + 'blank-start' => false, + 'show' => false, + 'view' => false, + 'map' => 'list_show_map', + 'map-opened' => 'list_map_show_opened', + 'map-name-link' => 'list_map_show_detaillink', + 'map-logo' => 'list_map_show_logo', + 'map-description' => 'list_map_show_descr', + 'map-short-description' => 'list_map_show_short_descr', + 'map-address' => 'list_map_show_address', + 'map-street' => 'list_map_show_street', + 'map-city-state-zip' => 'list_map_show_citystatezip', + 'map-country' => 'list_map_show_country', + 'map-region' => 'list_map_show_region', + 'map-phone' => 'list_map_show_phone', + 'map-toll-free' => 'list_map_show_tollfree', + 'map-url' => 'list_map_show_url', + 'map-url-new-target' => 'list_map_show_url_newtarget', + 'map-email' => 'list_map_show_email', + 'map-categories' => 'list_map_show_categories', + 'map-credit-cards' => 'list_map_show_creditcards', + 'map-amentities' => 'list_map_show_amenities', + 'search' => 'list_show_search', + 'search-filters-opened' => 'list_show_search_filters_opened', + 'search-text' => 'list_show_search_text', + 'search-categories' => 'list_show_search_category', + 'search-amenities' => 'list_show_search_amenities', + 'search-alpha' => 'list_show_search_alpha', + 'list' => 'list_show_list', + 'name-link' => 'list_show_detail_link', + 'logo' => 'list_show_logo', + 'address' => 'list_show_address', + 'street' => 'list_show_street', + 'city-state-zip' => 'list_show_citystatezip', + 'country' => 'list_show_country', + 'region' => 'list_show_region', + 'description' => 'list_show_descr', + 'short-description' => 'list_show_short_descr', + 'phone' => 'list_show_phone', + 'toll-free' => 'list_show_tollfree', + 'url' => 'list_show_url', + 'url-new-target' => 'list_show_url_newtarget', + 'email' => 'list_show_email', + 'categories' => 'list_show_categroies', + 'credit-cards' => 'list_show_creditcards', + 'amentities' => 'list_show_amenities', + 'amenity-groups' => false, + 'packages' => 'list_show_packages', + 'packages-link' => 'list_show_packages_link', ) ), 'glm-member-detail' => array( - 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, - 'menu' => 'members', - 'action' => 'detail', - 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'detail', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', 'attributes' => array( - 'id' => false, - 'show' => false, - 'map' => 'detail_show_map', - 'map-logo' => 'detail_map_show_logo', - 'map-description' => 'detail_map_show_descr', - 'map-short-description' => 'detail_map_show_short_descr', - 'map-address' => 'detail_map_show_address', - 'map-street' => 'detail_map_show_street', - 'map-city-state-zip' => 'detail_map_show_citystatezip', - 'map-country' => 'detail_map_show_country', - 'map-region' => 'detail_map_show_region', - 'map-phone' => 'detail_map_show_phone', - 'map-toll-free' => 'detail_map_show_tollfree', - 'map-url' => 'detail_map_show_url', - 'map-url-new-target' => 'detail_map_show_url_newtarget', - 'map-email' => 'detail_map_show_email', - 'map-categories' => 'detail_map_show_categories', - 'map-credit-cards' => 'detail_map_show_creditcards', - 'map-amentities' => 'detail_map_show_amenities', - 'logo' => 'detail_show_logo', - 'address' => 'detail_show_address', - 'street' => 'detail_show_street', - 'city-state-zip' => 'detail_show_citystatezip', - 'country' => 'detail_show_country', - 'region' => 'detail_show_region', - 'description' => 'detail_show_descr', - 'short-description' => 'detail_show_short_descr', - 'phone' => 'detail_show_phone', - 'toll-free' => 'detail_show_tollfree', - 'url' => 'detail_show_url', - 'url-new-target' => 'detail_show_url_newtarget', - 'email' => 'detail_show_email', - 'categories' => 'detail_show_categories', - 'credit-cards' => 'detail_show_creditcards', - 'amentities' => 'detail_show_amenities' + 'id' => false, + 'show' => false, + 'map' => 'detail_show_map', + 'map-logo' => 'detail_map_show_logo', + 'map-description' => 'detail_map_show_descr', + 'map-short-description' => 'detail_map_show_short_descr', + 'map-address' => 'detail_map_show_address', + 'map-street' => 'detail_map_show_street', + 'map-city-state-zip' => 'detail_map_show_citystatezip', + 'map-country' => 'detail_map_show_country', + 'map-region' => 'detail_map_show_region', + 'map-phone' => 'detail_map_show_phone', + 'map-toll-free' => 'detail_map_show_tollfree', + 'map-url' => 'detail_map_show_url', + 'map-url-new-target' => 'detail_map_show_url_newtarget', + 'map-email' => 'detail_map_show_email', + 'map-categories' => 'detail_map_show_categories', + 'map-credit-cards' => 'detail_map_show_creditcards', + 'map-amentities' => 'detail_map_show_amenities', + 'logo' => 'detail_show_logo', + 'address' => 'detail_show_address', + 'street' => 'detail_show_street', + 'city-state-zip' => 'detail_show_citystatezip', + 'country' => 'detail_show_country', + 'region' => 'detail_show_region', + 'description' => 'detail_show_descr', + 'short-description' => 'detail_show_short_descr', + 'phone' => 'detail_show_phone', + 'toll-free' => 'detail_show_tollfree', + 'url' => 'detail_show_url', + 'url-new-target' => 'detail_show_url_newtarget', + 'email' => 'detail_show_email', + 'categories' => 'detail_show_categories', + 'credit-cards' => 'detail_show_creditcards', + 'amentities' => 'detail_show_amenities', ) ) );