From: Steve Sutton Date: Thu, 15 Sep 2016 16:06:17 +0000 (-0400) Subject: Update the region-search actionData so it can be multiple id's X-Git-Tag: v2.5.6^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=4abad4f2fe5a7fbd23d61c8099b172e9b0ea72d3;p=WP-Plugins%2Fglm-member-db.git Update the region-search actionData so it can be multiple id's Using example from the category one to apply the same algorithm to the region-search arg in shortcode. --- diff --git a/models/front/members/list.php b/models/front/members/list.php index 4dfad1a3..9fbaf03f 100644 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -406,9 +406,19 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // If we have a region if ($actionData['request']['region-search']) { - $regionSearch = $actionData['request']['region-search']-0; - if ($regionSearch > 0) { - $where .= $whereSep." T.region = $regionSearch"; + $regions = array(); + // Convert comma separated list to an array + $regionsRequested = explode( ',', $actionData['request']['region-search'] ); + + // Check for numeric ID's only + while ( list( $k, $v ) = each( $regionsRequested ) ) { + if ( preg_match( '/^[0-9]*$/', trim( $v ) && $v > 0 ) ) { + $regions[] = ( $v - 0 ); + } + } + + if ( isset( $regions ) && !empty( $regions ) ) { + $where .= $whereSep." T.region IN (" . implode( ',', $regions ) . ")"; $whereSep = ' AND '; } }