Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Darin Kotter

    (@dkotter)

    @wordpresssites Can you expand on what you’re trying to achieve? Once an avatar is uploaded, you should see that avatar in the user’s profile, which will tell you if the avatar has been added.

    But I’m assuming you’re wanting a way to check if the user’s avatar was set using Simple Local Avatars or if it’s one that’s coming from Gravatar, without having to know what image(s) that particular user may have set.

    If that’s the case, there isn’t a built-in method that will tell you that (though that may be something we could consider adding to the roadmap) but you could check if a particular user has the proper local avatar meta set.

    For instance, if you know the user ID, you can check to see if get_user_meta( $user_id, 'simple_local_avatar', true ) is set and if so, you know that user has a local avatar they’ve uploaded.

    Edit: to be safe, probably should also check that the meta has the right key set as well:

    
    $local_avatar = get_user_meta( $user_id, 'simple_local_avatar', true );
    if ( empty( $local_avatars['full'] ) ) {
    	return false; // no avatar set
    }
    
    • This reply was modified 3 years, 1 month ago by Darin Kotter.
    • This reply was modified 3 years, 1 month ago by Darin Kotter.
    Thread Starter Brad Dalton

    (@wordpresssites)

    Thanks Darin, its for the author avatar to check if they have a avatar to display on the front end.

    Thread Starter Brad Dalton

    (@wordpresssites)

    Resolved. Thanks for a great plugin and support!

    I used :

    $author_id = get_the_author_meta( 'ID' );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How To Check If Profile Image Added’ is closed to new replies.