WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
retrieving the users avatar from comments (2 posts)

  1. sandor
    Member
    Posted 3 years ago #

    thanks for this wonderful plugin. i am trying to get the avatars from a comment via your JSON api.

    This is working fine when i am extending the comment.php:

    $this->email = $wp_comment->comment_author_email;

    This not:

    $this->avatar = $wp_comment->comment_author_avatar;

    Sorry for the ignorance here, i am sure that my question is very evident - but i'm really a newbie to coding :-)

    Cheers,

    Sandor

  2. dphiffer
    Member
    Plugin Author

    Posted 3 years ago #

    Hi sandor,

    Sorry for the slow reply.

    I think your instinct is right, but it seems that $wp_comment objects don't get avatars added by WordPress. There's a function called get_avatar (ref) that would be the way to do this.

    I think it's a good feature idea, but I'm going to hold off on implementing it for now. If you want to share your approach here, I'd consider it for the main release.

    Thanks,
    -Dan

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags