ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Help needed with Gravatars

July 14, 2012 10:01am

Subscribe [2]
  • #1 / Jul 14, 2012 10:01am

    k2zs

    114 posts

    I’m trying to build a comments section on a site and am having issues generating the correct gravatars for each comment that gets posted. For some reason they all show up as my gravatar (for admins email address) regardless of the email address posted in the comment. I have verified this by viewing source and the link to the gravatar site uses the same user ID for each entry.

    Here is my code:

    {exp:comment:entries channel="{this_channel}"}
    
    <div class="comment-container">
     <div class="avatar">{exp:gravatar email=</div>
     <div class="comment-right">
      <div class="comment-head">
       <span class="name-fl">{url_as_author} said:</span>
       <span class="date-fr">{comment_date format="%F %d %Y"}</span>
       <div class="clr"></div>
      </div><!-- /comment-head -->
      <div class="comment-entry"  id="comment-{comment_id}">
       {comment}
      </div><!-- /comment-entry -->
     </div><!-- /comment-right -->
     <div class="clr"></div>
    </div><!-- /comment-container -->
    
    {/exp:comment:entries}

    Any ideas what may be happening?

  • #2 / Jul 14, 2012 10:14am

    the3mus1can

    426 posts

    My guess is you have this comment entries loop inside of an entries loop?  If so, the {email} variable is getting parsed by the channel entries loop. So it is the email address of the author of the entry which is most likely your email address.  To fix this put the comments entries inside of an embed and pass the entry_id into the embed and then pass it as a parameter to the comments entries tag.

  • #3 / Jul 14, 2012 11:28am

    k2zs

    114 posts

    Ah Ha! Very good then. I was showing comments as a snippet inside the entries loop because that was the only way I could get it to work. I switched it over to an embed and passed in “entry_id” and “title” and all seems to be working now, thanks for your help…

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases