-
Author
Tagged: search
-
June 16, 2015 at 09:15 #63075maelgaParticipant
Hi Laura,
I have customised my horizontal search as an advanced search form and everything looks neat.
However 1 of the field type is checkbox with 10 options to choose from.
When running the search, the results returned are profiles that match any of the options checked (i.e. OR search).
For my site, it must be a AND search, e.g. only profiles matching all checkboxes should be returned.How to edit the kleo-bp-search.php to achieve this?
I got a way to do it with BP Profile Search plugin (https://wordpress.org/support/topic/checkbox-search-for-both-rather-than-or) but BP Profile Search does not work with Sweetdate (see my previous thread: https://archived.seventhqueen.com/forums/topic/conflict-with-bp-profile-search-plugin).
Implementing the BP Profile Search way into kleo-bp-search.php does not work.
Looking at both codes, it should be very similar though.Any idea how to make it work in kleo-bp-search.php?
Alternatively, back to my previous thread: How to make BP Profile Search work with Sweetdate?June 17, 2015 at 16:09 #63465LauraModeratorHello, thank you very much for contacting us , will assign the ticket to a higher support lever who can help and advise you in your query.
It would be good to have you credentials to facilitate our work.
Thanks! 🙂Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
June 21, 2015 at 07:55 #64157AndreiModeratorHi @maelga, I will gonna give a look into this and come with a reply as soon as possible.
Thank you for your patience.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJune 23, 2015 at 14:58 #64457AndreiModeratorHi,
I have given a look into this and it seems the query is OR for multiselects/checkboxes.
You can change this from the “wp-content/themes/sweetdate/custom_buddypress/kleo-bp-search.php” file at line: 671.Let me know if it worked.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJune 23, 2015 at 16:28 #64493maelgaParticipantHi Andrei,
Changing
$sql .= ' AND ('. implode (' OR ', $like). ')';
to$sql .= ' AND ('. implode (' AND ', $like). ')';
does not work.You can have a head start by spending 30 sec reading this brief thread:
https://wordpress.org/support/topic/checkbox-search-for-both-rather-than-or?replies=8The solution was to replace `$like[] = $wpdb->prepare (“value = %s OR value LIKE %s”, $value, $escaped);
}
$sql .= ‘AND (‘. implode (‘ OR ‘, $like). ‘)’;with
$like[] = $wpdb->prepare (“value LIKE %s”, $escaped);
}
$sql .= ‘AND (‘. implode (‘ AND ‘, $like). ‘)’;`I have tested it with both BP Profile Search and kleo-search.php. It works with BP Profile Search but unfortunately not with kleo-search.php
Do you have any suggestion?
June 23, 2015 at 16:30 #64495maelgaParticipantSame code as above, just making it clearer:
COPY CODE$like[] = $wpdb->prepare ("value = %s OR value LIKE %s", $value, $escaped); } $sql .= 'AND ('. implode (' OR ', $like). ')';
with
COPY CODE$like[] = $wpdb->prepare ("value LIKE %s", $escaped); } $sql .= 'AND ('. implode (' AND ', $like). ')';
June 23, 2015 at 17:41 #64524AndreiModeratorI have just tested this scenario out to be sure it works, please revert your kleo-bp-search.php file to the stock one, and taking into consideration that you have the last version of the theme, go to line 671 and replace:
COPY CODE$sql .= ' AND ('. implode (' OR ', $like). ')';
with
COPY CODE$sql .= ' AND ('. implode (' AND ', $like). ')';
Cheers
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
You must be logged in to reply to this topic.