Is it possible to get the commenter's avatar through the comment:entries tag?

{exp:comment:entries sort="asc" limit="9" paginate="bottom" dynamic="no"}
                        <figure class="profile-photo"><img src="{if avatar_url}{exp:imgsizer:size src='{avatar_url}' width='120' height='120'}{sized}{/exp:imgsizer:size}{if:else}{site_url}img/assets/default_avatar.png{/if}" alt=""></figure><aside>
                            <div class="meta-info">
                                <p><a href="#">{name}</a> <time>{comment_date format="%Y %m %d"}</time></p><i class="icon-review"></i>
                                <p>{exp:stringy:striptags allowed_tags=""}{comment}{/exp:stringy:striptags}</p>
                    <div class="pagination">
                        <p>Page {pagination_page_number} of {total_pages}:</p><!--
                            {previous_page}<li><a href="{pagination_url}" class="prev"><i class="icon-left-arrow"></i></a></li>{/previous_page}<!--
                            -->{page}<li><a href="{pagination_url}" class="page {if current_page}active{/if}">{pagination_page_number}</a></li>{/page}<!--
                            -->{next_page}<li><a href="{pagination_url}" class="next"><i class="icon-right-arrow"></i></a></li>{/next_page}

Here is my current code for the latest comments, it doesn't seem to be grabbing the member's avatar?

Any ideas?

Thanks All the best -Graham.

  • If you remove the imgsizer plugin tag and just replace with the avatar_url does it output anything? Apr 8 '15 at 16:30
  • Hi Brandon, thanks for getting back to me, Unfortunately not, I've tried stripping it down to the bare bones, even querying inside the entries loop but having no luck. Apr 8 '15 at 16:38
  • Try just using this and see if anything is outputted. {exp:comment:entries}{if avatar}{avatar_url}{/if}{/exp:comment:entries} Apr 8 '15 at 16:41
  • Still nothing unfortunately Apr 8 '15 at 16:46
  • Try removing the if statement. If that doesn't work what version of EE are you using? When you used the code above, did the comment text show? Are you certain the users commenting have Avatars? Apr 8 '15 at 16:49

Take the exp:comment:entries tag out of the exp:channel:entries tag and supply either the entry_id or url_title of the entry you want. The avatar_url variable is being overwritten by the channel:entries variable.

{exp:comment:entries entry_id="XXX" sort="asc" limit="9" paginate="bottom" dynamic="no"}
   <img src="{avatar_url}" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.