Home Forums Plugin Support WP User Frontend Pro Display the uploaded avatar

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Joakim-sb 5 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4705

    Joakim-sb
    Participant
    Post count: 3

    Hello,

    Thanks for a great plugin. I have a question about avatars in this plugin. I have a registration form so that users can edit their profile, which works fine. In this form I'm using the avatar profile field so that the user can upload an avatar. But how do I display the uploaded avatar?

    I know that WordPress uses gravatars by default when I use get_avatar(), but i don't want to display gravatars, I want to display the uploaded avatar. Is this possible? How does this avatar upload actually work?

    Help would be much appreciated.

    #4714

    Tareq Hasan
    Keymaster
    Post count: 2831

    Hi,

    WP User Frontend uses the same get_avatar function for showing the avatar image. If you use the get_avatar function, it'll search for any uploaded image through the plugin. If not, it'll show the default gravatar instead.

    #4716

    Joakim-sb
    Participant
    Post count: 3

    Hi Tareq,

    Thanks for answering. That's the problem, I am using the get_avatar() function in my author.php file, but it won't display the uploaded image. Instead it displays a gravatar, or the “mystery man” image which you can select in the admin dashboard.

    However, up in the admin bar where it says “Howdy, …”, my uploaded image is actually displayed. Why is it not working in my author.php file? Have I missed something perhaps? Do I need to add something in the function, like an ID or something else?

    #4718

    Tareq Hasan
    Keymaster
    Post count: 2831

    As the howdy area looks as expected, then everything looks fine. May be you should pass the user id or the user email in the get_avatar function and see if it works.

    #4719

    Joakim-sb
    Participant
    Post count: 3

    Hi again Tareq,

    I managed to fix it, simply by putting the user id inside the get_avatar() function, like this; get_avatar( $curauth->id );

    Thanks for helping!

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

The topic ‘Display the uploaded avatar’ is closed to new replies.