viktron
Forum Replies Created
-
Thank you for your efforts, I’m really glad now as your final code did the trick.
Almost there. Code snippet update #2 show results if the first_name starts with the keyworld defined for search, so partial results listed:
The final step would be to get the same results for ‘code_3_cf’ as with ‘code_3_%cf’, without the ‘%’ character to be used during search.
Thanks for being involved.
Unfortunately your extended code snippet still does not provide the desired results, rather it shows false count of members by search criteria and not listing out real results. So, the situation is like this as of now:
1. Without any code looking for only ‘first_name’ custom field during search result:
Please note, that user ‘Bbb Cf2’ has a hidden custom field called ‘Personal ID’ set as ‘Aaa’ which I do not want to search/get results for.
2. Without any code looking for only ‘first_name’ custom field during search result:
3. With original code snippet, searching for keyword ‘aa’:
4. With original code snippet, searching for keyword ‘aaa’:
Please note it is the expected result for my issue using either ‘aa’ or ‘aaa’ as keyword.
5. Extended code snippet, searching for keyword ‘aa’:
6. Extended code snippet, searching for keyword ‘aaa’:
So still no luck and already over my capabilities to solve it on my own. I would appreciate looking further into the case..
Any chance to fine tune the code snippet according the issue above?
The code provided above works only if exact full content of first_name meta typed into search field, like ‘Sarah’. If you are searching for a part of it, like ‘Sara’ or ‘sara’ it won’t show any results. Please advise how to get all results based on partially given meta data (e.g., typed ‘sar’ or just ‘sa’ into the search field) to have all ‘Sarah’ displayed.
@sterndata got it, edited my post.
Inserting the code into functions.php does not provide any output, no user showing up in member directory listing. Can you please advise how to go further?
- This reply was modified 3 years, 11 months ago by viktron.
What I would like to achieve is to pre-filter the Search function to look values only within ‘first_name’ metadata, without additional filter criteria specified for Search Bar. For example, if I’m going to look for someone with ‘first_name’ ‘Sarah’, I expect results based on first_name metadata only. Currently, I do have additional custom fields, like ‘mothers_name’, so enabling ‘custom table for usermeta option’ will result showing everyone in the results, who has Sarah in her first_name and/or mothers_name as well. With the code provided in OP, I was able to filter the results as expected.
First of all, thanks for your feedback.
Unfortunately with this code snippet no results can be displayed, even the previously found records not showing up, where the search was including every metadata defined by custom fields.
Any suggestions about fine tuning the query?
Hi,
Thanks for quick answer, really appreciate it.
Hi there,
I’m interested in how did you enforced ACF fields to be updated bidirectionally after import process, I’m walking in similar shoes as you were recently.
Thanks and regards.