This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Use of users custom fields in a product search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Use of users custom fields in a product search Reply To: Use of users custom fields in a product search

#27145
Ernest MarcinkoErnest Marcinko
Keymaster

Well, try this custom code then:

add_filter( 'asp_results', 'asp_custom_images_gr', 10, 4 );
function asp_custom_images_gr( $results, $id, $is_ajax, $args ) {
	foreach ($results as $k=>&$r) {
		if ( $r->content_type == 'user' ) {
			$s = get_user_meta( $r->id, 'wcfmmp_profile_settings', true );
			if ( isset($s['gravatar']) ) {
				$r->image = get_avatar_url($s['gravatar']);
			}
		}
	}

	return $results;
}

I suspect that this may not work though, usually gravatars are handled by WordPress internally, and the search should already return them when they are enabled – but it’s worth a try.