Update with county-search
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 20 Dec 2018 15:29:58 +0000 (10:29 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 20 Dec 2018 15:29:58 +0000 (10:29 -0500)
Adding county-search from shortcode.

models/front/members/list.php

index 2208add..4155582 100755 (executable)
@@ -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) {