Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › WCFM user image in search results
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year ago.
- AuthorPosts
- March 14, 2022 at 2:03 pm #37157
Hi,
I just bought the plugin to integrate it with WCFM Ultimate plugin.
My problem is that it doesn’t fetch the vendor avatar because of the way WCFM stores user’s(vendor/store) image. Attached is a screenshot of how it shows right now.
Prior to this I saw you successfully managed to help another user having a similar problem but different context(I can provide the link of the topic if needed). I tried the code provided in that topic but I guess it doesn’t work because the context was about showing vendor’s avatar in products search results while I want to show it in user dedicated search as per the screenshot.
Do I need to provide further code examples of how WCFM handles this on their dedicated Stores listing page?
Thanks!
Attachments:
You must be logged in to view attached files.March 14, 2022 at 3:52 pm #37161Hi,
I am not sure which topic was that, but I have found on with this:
add_filter( 'asp_results', 'asp_get_custom_wcfm_vendor_image', 10, 1 ); function asp_get_custom_wcfm_vendor_image( $results ) { foreach ($results as $k=>&$r) { if ( $r->content_type == 'user' ) { $store = wcfmmp_get_store( $r->id); $img = $store->get_avatar(); if ( !is_wp_error($img) && !empty($img) ) $r->image = $img; } } return $results; }
This is specifically for user type of results, based on their API. If it does not work, then please let me know the method to get the image by the user ID, that should be an easy edit afterwards.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 14, 2022 at 5:31 pm #37167You are the BEST!
It works!
Thank you so much
March 15, 2022 at 9:44 am #37170You cannot access this content. 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.