get_avatar support

This topic contains 11 replies, has 2 voices, and was last updated by

 
Keymaster
3 years, 10 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #17039

    Participant

    We are trying to do a user search and need to use the get_avatar to pull the user avatar image. If you go to the link below and type in “steve” you will see our user images are not showing up. I could not find any instructions on how to incorporate the get_avatar function – http://geniecast.staging.wpengine.com/?s

    #17041

    Hi!

    May I ask what type of results are those? (custom post type, or users) Because the user results use the get_avatar() function by default to get the user avatars.

    Can you please add temporary FTP and back-end access? I will check the configuration and debug through the search process to see what the image field returns.

    Best,
    Ernest Marcinko

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


    #17044

    Participant
    You cannot access this content.
    #17084

    Participant

    just making sure my private reply went through? I never received an email confirmation… thanks!

    #17087
    You cannot access this content. Best,
    Ernest Marcinko

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


    #17088

    Hi!

    It appears that there is some sort of custom filter added to the ‘get_avatar’ function, which returns the correct image. The “get_avatar_url” however is not filtered, so it does not return the correct image.

    I have added the following custom code to the end of the functions.php file in your active theme directory to resolve the images:

    add_filter( 'asp_results', 'asp_fix_res_avaras', 10, 2 );
    function asp_fix_res_avaras( $results ) {
    	foreach($results as $k=>&$r) {
    		if ( $r->content_type == 'user' ) {
    			$r->image = get_avatar_urlx(get_avatar($r->id, 150));
    		}
    	}
    	return $results;
    }
    function get_avatar_urlx( $get_avatar ) {
        preg_match("/url\(http:(.*?)\);/i", $get_avatar, $matches);
        return $matches[1];
    }

    Now they should display correctly.

    Best,
    Ernest Marcinko

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


    #17093

    Participant

    This is great! Do we need to be concerned about updating the plugin? Will it overwrite this custom code?

    Also, on this search – is it possible to have the users and the posts show in two separate sections below the search box? Ideally we would love to have the users come up first in the Isotopic view and then below that a title that says “Programs” and have the posts show up under there in another (perhaps vertical) view. We didn’t know if we could make one box launch 2 results – or at least if we cannot do that, separate the users and posts if not? We have been watching the videos but did not see an example of this yet.

    Thank you again!

    #17103

    Hi!

    Unfortunately that is not possible.
    With the vertical layout, you can use the results grouping feature, but the isosopic is not capable of that. For this to work, you need two separate search bars. What I usually see is in these types of situations, is that people tend to create two search bars, side-by-side, one to search one thing, and the other for the other thing.

    Best,
    Ernest Marcinko

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


    #17126

    Participant

    Thank you.

    Are we also able to add a function such that the user search only pulls users who are defined by certain fields we have defined in the wp_usermeta table? In other words, we have a field for type of user and we want to only pull ones that are “genie” and then we have a field for deal stage and we only want to pull those who are “Active”

    The wp_usermeta database field for type of user is named “paupress_pp_ind_type” and for the deal stage is named “1e807c29f1fbbadd44b66f1cdda07fca”

    #17135

    Hi!

    It might be possible, but I am not sure about this one to be honest.

    Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    If the fields given were correct, then this should possibly work.

    Best,
    Ernest Marcinko

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


    #17144

    Participant

    That worked! Thank you so much. This plugin is outstanding.

    One final question – is there a way to display the result count using code? Something like {count}?

    I looked in documentation but did not find. I am using grouped results and wanted to put a title at top of page with something like your search found XX genies and XX programs.

    I already added the result count automatically as the header for each group in the settings in the plugin, but since user has to scroll down for larger result sets, we wanted to give the total result count for each group at top of page right under search bar before the groups.

    #17157

    Hi!

    Thanks for your kind words.

    Do you mean the results page where the search bar is displayed? It might be possible, by editing the theme search.php file. Without coding however that is not possible: https://wordpress.stackexchange.com/questions/108865/display-search-result-count/108866

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.