Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › get_avatar support
This topic contains 11 replies, has 2 voices, and was last updated by Ernest Marcinko 5 years, 2 months ago.
- AuthorPosts
- March 8, 2018 at 4:39 am #17039
We are trying to do a user search and need to use the get_avatar to pull the user avatar image. If you go to the link below and type in “steve” you will see our user images are not showing up. I could not find any instructions on how to incorporate the get_avatar function – http://geniecast.staging.wpengine.com/?s
March 8, 2018 at 10:16 am #17041Hi!
May I ask what type of results are those? (custom post type, or users) Because the user results use the get_avatar() function by default to get the user avatars.
Can you please add temporary FTP and back-end access? I will check the configuration and debug through the search process to see what the image field returns.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 8, 2018 at 6:04 pm #17044You cannot access this content.March 10, 2018 at 10:18 pm #17084just making sure my private reply went through? I never received an email confirmation… thanks!
March 12, 2018 at 10:30 am #17087You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 12, 2018 at 10:53 am #17088Hi!
It appears that there is some sort of custom filter added to the ‘get_avatar’ function, which returns the correct image. The “get_avatar_url” however is not filtered, so it does not return the correct image.
I have added the following custom code to the end of the functions.php file in your active theme directory to resolve the images:
add_filter( 'asp_results', 'asp_fix_res_avaras', 10, 2 ); function asp_fix_res_avaras( $results ) { foreach($results as $k=>&$r) { if ( $r->content_type == 'user' ) { $r->image = get_avatar_urlx(get_avatar($r->id, 150)); } } return $results; } function get_avatar_urlx( $get_avatar ) { preg_match("/url\(http:(.*?)\);/i", $get_avatar, $matches); return $matches[1]; }
Now they should display correctly.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 12, 2018 at 4:38 pm #17093This is great! Do we need to be concerned about updating the plugin? Will it overwrite this custom code?
Also, on this search – is it possible to have the users and the posts show in two separate sections below the search box? Ideally we would love to have the users come up first in the Isotopic view and then below that a title that says “Programs” and have the posts show up under there in another (perhaps vertical) view. We didn’t know if we could make one box launch 2 results – or at least if we cannot do that, separate the users and posts if not? We have been watching the videos but did not see an example of this yet.
Thank you again!
March 13, 2018 at 7:31 am #17103Hi!
Unfortunately that is not possible.
Best,
With the vertical layout, you can use the results grouping feature, but the isosopic is not capable of that. For this to work, you need two separate search bars. What I usually see is in these types of situations, is that people tend to create two search bars, side-by-side, one to search one thing, and the other for the other thing.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 14, 2018 at 10:24 pm #17126Thank you.
Are we also able to add a function such that the user search only pulls users who are defined by certain fields we have defined in the wp_usermeta table? In other words, we have a field for type of user and we want to only pull ones that are “genie” and then we have a field for deal stage and we only want to pull those who are “Active”
The wp_usermeta database field for type of user is named “paupress_pp_ind_type” and for the deal stage is named “1e807c29f1fbbadd44b66f1cdda07fca”
March 15, 2018 at 12:43 pm #17135Hi!
It might be possible, but I am not sure about this one to be honest.
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!
If the fields given were correct, then this should possibly work.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 16, 2018 at 1:55 am #17144That worked! Thank you so much. This plugin is outstanding.
One final question – is there a way to display the result count using code? Something like {count}?
I looked in documentation but did not find. I am using grouped results and wanted to put a title at top of page with something like your search found XX genies and XX programs.
I already added the result count automatically as the header for each group in the settings in the plugin, but since user has to scroll down for larger result sets, we wanted to give the total result count for each group at top of page right under search bar before the groups.
March 16, 2018 at 3:55 pm #17157Hi!
Thanks for your kind words.
Do you mean the results page where the search bar is displayed? It might be possible, by editing the theme search.php file. Without coding however that is not possible: https://wordpress.stackexchange.com/questions/108865/display-search-result-count/108866
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.