WordPress.org

Ready to get started?Download WordPress

Forums

get_avatar is parsing with current host url (1 post)

  1. dcarmo
    Member
    Posted 2 years ago #

    Hello everyone,

    I am trying to get the avatar of people who post a comment on my post and send it back through a JSON object. The user hits a URL with specific parameters and the URL returns the JSON object.

    My problem is with the get_avatar function. The URL that it is returning is hostname + path + gravatarURL. The hostname and path is the origional site that they hit to make the API call.

    To get the avatar I just iterate through all the comments and add to each comment my own avatar item.


    $comment_with_avatar = null;
    foreach($comments as $comment)
    {
    $comment_with_avatar[] = array (
    'avatar'=>get_avatar($comment),
    'comment'=>$comment
    );
    }

    the comments all print fine, but the avatar from the site comes back blank and the url is encoded and in the format explained above. For example

    hostname.com%5C/pathname%5C/0.gravatar.com%5C/...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags