Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › get_avatar support › Reply To: get_avatar support
March 12, 2018 at 10:53 am
#17088
Hi!
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 :)