From: Steve Sutton Date: Thu, 20 Dec 2018 15:29:58 +0000 (-0500) Subject: Update with county-search X-Git-Tag: v2.11.0^2~34 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=58086b93f68be11bbeb8e3b977d6741a5cbcb43c;p=WP-Plugins%2Fglm-member-db.git Update with county-search Adding county-search from shortcode. --- diff --git a/models/front/members/list.php b/models/front/members/list.php index 2208add5..41555822 100755 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -351,6 +351,25 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo } } + $counties = array(); + if ($actionData['request']['county-search']) { + + // Convert comma separated list to an array + $regionsRequested = explode( ',', $actionData['request']['county-search'] ); + + // Check for numeric ID's only + while ( list( $k, $v ) = each( $regionsRequested ) ) { + if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) { + $counties[] = ( $v - 0 ); + } + } + + if ( isset( $counties ) && !empty( $counties ) ) { + $where .= $whereSep." T.county IN (" . implode( ',', $counties ) . ")"; + $whereSep = ' AND '; + } + } + // If there's regions shortcode or url options to restrict this page to certain regions if (count($regions) > 0) {