Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › WCFM user image in search results › Reply To: WCFM user image in search results
March 14, 2022 at 3:52 pm
#37161
Keymaster
Hi,
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.