From: Steve Sutton Date: Fri, 14 Apr 2017 17:46:09 +0000 (-0400) Subject: Add filter for the member search. X-Git-Tag: v1.0.0^2~19 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a89fb6df2db7c0b8017b198f7d527715bc3d1b9d;p=WP-Themes%2Fbrewbakers.git Add filter for the member search. This is to get the manufacturers into the member search as categories. --- diff --git a/functions.php b/functions.php index abb7dbc..7c69d9a 100644 --- a/functions.php +++ b/functions.php @@ -27,6 +27,20 @@ add_filter('manufacturer_ids', function(){ return $ids; }); +add_filter('glm-member-db-front-search-query', function() { + $queryParts = array(); + if ( isset( $_REQUEST['manufacturers'] ) && is_array( $_REQUEST['manufacturers'] ) && !empty( $_REQUEST['manufacturers'] ) ) { + $catSelectedForQuery = implode( ',', $_REQUEST['manufacturers'] ); + $queryParts[] = " T.id in ( + SELECT DISTINCT(member_info) + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M, + ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C + WHERE M.category in($catSelectedForQuery) + OR (C.parent in($catSelectedForQuery) AND M.category = C.id) + ) "; + } + return $queryParts; +}); /** * Return the client info option for the given key *