WCFM user image in search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support WCFM user image in search results

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37157
    carpealexdiem
    carpealexdiem
    Participant

    Hi,

    I just bought the plugin to integrate it with WCFM Ultimate plugin.

    My problem is that it doesn’t fetch the vendor avatar because of the way WCFM stores user’s(vendor/store) image. Attached is a screenshot of how it shows right now.

    Prior to this I saw you successfully managed to help another user having a similar problem but different context(I can provide the link of the topic if needed). I tried the code provided in that topic but I guess it doesn’t work because the context was about showing vendor’s avatar in products search results while I want to show it in user dedicated search as per the screenshot.

    Do I need to provide further code examples of how WCFM handles this on their dedicated Stores listing page?

    Thanks!

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

    Hi,

    I am not sure which topic was that, but I have found on with this:

    add_filter( 'asp_results', 'asp_get_custom_wcfm_vendor_image', 10, 1 );
    function asp_get_custom_wcfm_vendor_image( $results ) {
    	foreach ($results as $k=>&$r) {
    		if ( $r->content_type == 'user' ) {
    			$store = wcfmmp_get_store( $r->id);
    			$img = $store->get_avatar();
    			if ( !is_wp_error($img) && !empty($img) )
    				$r->image = $img;
    		}
    	}
    	return $results;
    }

    This is specifically for user type of results, based on their API. If it does not work, then please let me know the method to get the image by the user ID, that should be an easy edit afterwards.

    Best,
    Ernest Marcinko

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


    #37167
    carpealexdiem
    carpealexdiem
    Participant

    You are the BEST!

    It works!

    Thank you so much

    #37170
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.