Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › User search conditional brackets and exclude by usermeta values
This topic contains 2 replies, has 2 voices, and was last updated by davsev 5 years, 2 months ago.
- AuthorPosts
- January 21, 2018 at 8:06 am #16423
Hey,
I try to use conditionalConditional bracket examples
in user search.
I enter the brackets in the
Advanced description field
but it doesn’t work.this is the code:
[<strong>שם החברה:</strong>{pie_text_7} <br />] [<strong>מספר רשיון תיווך:</strong>{pie_phone_10} <br />] [<strong>נייד:</strong>{pie_phone_10} <br />] [<strong>טלפון במשרד:</strong> {pie_phone_11}]
Without the brackets it works great but I want to avoid empty lines.
Another issue,
How can I exclude from search result users that don’t have certain value in user meta field:
Something like this meta_query:$args = array( 'role' => 'Author', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'active', 'value' => '1', 'compare' => '=', ), array( 'relation' => 'OR', array( 'key' => 'wp_w3dev_user_banned', 'value' => '1', 'compare' => '!=', ), array( 'key' => 'wp_w3dev_user_banned', 'compare' => 'NOT EXISTS', ), ), ), );
Thank you.
DavidJanuary 22, 2018 at 5:08 pm #16443Hi,
1. The conditional brackets does not yet work with the user search fields, only with custom post types. The only solution is to use a custom code.
Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!2. This is unfortunately not possible via arguments, only with custom code to filter the users after the search process is finished. This is a bit more difficult, but this should help to get you started:
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 23, 2018 at 8:04 am #16447 - AuthorPosts
You must be logged in to reply to this topic.