Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Compatibility with another plugin › Reply To: Compatibility with another plugin
March 23, 2016 at 4:34 pm
#8175
You are welcome!
Well, I was going to suggest you to consult with the Avatar Manager plugin author on how to get those images, but instead I downloaded the plugin quickly and took a look at the code. I’ve found how to do it, and made the change for you.
For future reference, this is the final code with Avatar Manager support:
add_filter( 'asp_results', 'asp_get_yith_vendor_data', 1, 1 );
function asp_get_yith_vendor_data( $results ) {
foreach ($results as $k=>$v) {
if ( $v->content_type == "term" ) {
if( function_exists( 'YITH_Vendors' ) ){
$vendor_description = $vendor_logo = "";
$vendor = yith_get_vendor( $v->id, 'vendor' );
if( $vendor->is_valid() ){
$vendor_description = $vendor->description;
if ( function_exists('avatar_manager_get_custom_avatar') ) {
$vendor_logo_img = avatar_manager_get_custom_avatar( $vendor->get_owner() );
$iarray = array();
preg_match( '/src="([^"]*)"/i', $vendor_logo_img, $iarray ) ;
if (isset($iarray[1]))
$vendor_logo = $iarray[1];
} else {
$vendor_logo = get_avatar_url( $vendor->get_owner() );
}
}
$results[$k]->image = $vendor_logo;
$results[$k]->content = $vendor_description;
}
}
}
return $results;
}
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)