From: Steve Sutton Date: Tue, 20 Mar 2018 12:43:50 +0000 (-0400) Subject: Update search form for member search. X-Git-Tag: v1.0.17^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=1d8fc1fd734b8e86a2e8c3299c6e1b03b6ac0c4b;p=WP-Themes%2Fwmta.git Update search form for member search. Had this is main member plugin but now moving it into the wmta theme. This will add to the member search sql when searching the site. So we can add city name search results. --- diff --git a/functions.php b/functions.php index e692562..9a615be 100644 --- a/functions.php +++ b/functions.php @@ -397,3 +397,20 @@ function new_mail_from($old) { function new_mail_from_name($old) { return 'WMTA'; } + +add_filter('glm-member-db-front-search-query', function( $queryParts ){ + if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { + $textSearch = addslashes(filter_var($_REQUEST['s'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)); + $queryParts[] = " ( + ( + SELECT true + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members + WHERE id = T.member + AND name LIKE '%$textSearch%' + ) + OR T.descr LIKE '%$textSearch%' + OR T.city IN ( SELECT id FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities WHERE name LIKE '%$textSearch%' ) + )"; + } + return $queryParts; +}); diff --git a/inc/custom.php b/inc/custom.php index 2221958..ebf488a 100644 --- a/inc/custom.php +++ b/inc/custom.php @@ -126,7 +126,7 @@ add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom functio function display_memberfindme_directory() { // Show MemberFindMe shortcode from Directory page - $_REQUEST['textSearch'] = $_REQUEST['s']; + //$_REQUEST['textSearch'] = $_REQUEST['s']; $_REQUEST['action'] = 'list'; $_REQUEST['event_name'] = $_REQUEST['s']; echo do_shortcode('[glm-members-list view="grid" ]'); diff --git a/style.css b/style.css index b99312e..a19548b 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: http://underscores.me/ Author: Underscores.me Author URI: http://underscores.me/ Description: Description -Version: 1.0.16 +Version: 1.0.17 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: wmta