Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
- This topic has 3 replies, 2 voices, and was last updated 9 years, 11 months ago by
Steven Zahm.
-
AuthorPosts
-
08/29/2016 at 8:58 am #388087
Brittany Vacchiano
ParticipantHi Steven –
First off, thank you for your helpful support for your plugin. All of your answers have helped me write the code that I needed to write to get your plugin working on my site!
There is one question that I have about the Connections search. I noticed that you split multi-word strings upon searching. For instance if you search
John Doe, your search actually splits the string and searches for the whole word:John Doe, John, Doe. Is there anyway that I can modify the plugin (using a hook or filter) to only search for the whole string & not the separated/split string with the whole string.The reason I ask is because users some of my users are complaining that they can’t find exactly what they’re looking for when they search, and not splitting the search string would solve that problem.
08/29/2016 at 3:52 pm #388113Steven Zahm
Keymaster@ Brittany
Sure, you could hook into the
cn_search_termsfilter. Here’s an example:add_filter( 'cn_search_terms', 'cn_exact_search_only' ); function cn_exact_search_only( $terms ) { return $terms[0]; }The
$termsvariable is an array where index0will be the whole string.Hope that helps!
09/07/2016 at 11:56 am #389967Brittany Vacchiano
ParticipantHi Steven –
I have implemented the filter you mentioned above & verified that the cn_search_terms filter is returning just the first entry in the
termsarray.However, when
$atts['terms'] = $this->parse_search_terms(line 2319 of class.retrieve.php) is ran, an empty array is being returned and, thus, returned no search results.After much trial and error, I figured out that you need to return
array($terms[0])instead of$terms[0]in the filter function you listed above. That seemed to do the trick!You can mark this as resolved!
09/07/2016 at 1:45 pm #390011Steven Zahm
Keymaster@ Brittany
Ahhh, yes, sorry about that! The filter needs to return an array, not a string which is what
$terms[0]would be. To help other who may come across this thread and do the same, here the corrected code:add_filter( 'cn_search_terms', 'cn_exact_search_only' ); function cn_exact_search_only( $terms ) { return array( $terms[0] ); } -
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
