User results have no profile image

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 rips9993 2 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #24746
    rips9993
    rips9993
    Participant

    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 Raver

    Thanks

    Phil.

    Attachments:
    You must be logged in to view attached files.
    #24750
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Your configuration seems to be completely fine, something else must have changed regarding PeepSo.
    Can you please add temporary FTP details, so I can debug the whole function? Thank you!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24762
    rips9993
    rips9993
    Participant
    You cannot access this content.
    #24764
    rips9993
    rips9993
    Participant
    You cannot access this content.
    #24774
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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 :)


    #24791
    rips9993
    rips9993
    Participant

    Thanks, we will try this fix soon and let you know.

    #24960
    rips9993
    rips9993
    Participant

    Hi 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.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.