Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › User results have no profile image
This topic contains 6 replies, has 2 voices, and was last updated by rips9993 3 years, 3 months ago.
- AuthorPosts
- November 26, 2019 at 11:50 am #24746
Hi there,
For some reason, our search is no longer displaying a profile image for user results, it was working fine but stopped a couple of weeks ago and I can’t figure out why. We are using Peepso social plugin.
You can try searching for users:
Phil Ripsy
Rainbow RaverThanks
Phil.
Attachments:
You must be logged in to view attached files.November 26, 2019 at 2:17 pm #24750Hi,
Your configuration seems to be completely fine, something else must have changed regarding PeepSo.
Best,
Can you please add temporary FTP details, so I can debug the whole function? Thank you!
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 27, 2019 at 3:07 am #24762You cannot access this content.November 27, 2019 at 3:26 am #24764You cannot access this content.November 27, 2019 at 1:32 pm #24774Hi,
I think I may have found something. There is a user meta field “peepso_avatar_hash” that seems to be linked with the avatar generation. I have looked at the final user avatar URLs, and it looks like it’s all the same, except this hash and the user ID.
The default WordPress get_avatar() function does not return anything here. The only way to resolve this is via a custom code.Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter('asp_results', 'asp_peepso_avatar_fix', 10, 1); function asp_peepso_avatar_fix($results) { foreach ($results as &$r) { if ( $r->content_type == 'user' ) { $hash = get_user_meta($r->id, 'peepso_avatar_hash', true); if ( !empty($hash) ) { $r->image = get_site_url() . '/wp-content/peepso/users/' . $r->id . '/' . $hash . '-avatar-full.jpg'; } } } return $results; }
If all goes well, this should resolve the avatar URLs in the live results.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 28, 2019 at 12:52 pm #24791Thanks, we will try this fix soon and let you know.
December 7, 2019 at 3:57 am #24960Hi Ernest,
Our tech lead reviewed this solution and found the problem was caused by a WP setting though still a Peepso coding issues primarily.
His comments are below:
Essentially the flaw is that Peepso hooks into the get_avatar and get_avatar_url filters when it probably needs to hook into the pre_get_avatar and pre_get_avatar_data filters.
The flaw can be circumvented by enabling the “Show Avatars” option in WordPress “Discussion Settings”. Fairly sure that setting has no other affects for us since Peepso overrides our comments sections.
Thanks,
Phil.
- AuthorPosts
You must be logged in to reply to this topic.