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.

Members avatar in comments for logged out users?

February 19, 2012 6:59am

Subscribe [2]
  • #1 / Feb 19, 2012 6:59am

    shorn

    79 posts

    Hi there,

    As Ive said in previous posts, i’m new to EE, but I’m getting there in building my first site. Ironing out a few issues at the moment.

    One being, that I have comments enabled for news items. When a comment is posted, it lists the author, their avatar, and their comment.
    My problem seems to be that the avatar on shows up when that user is logged in.

    If I’m logged out I cannot see the avatar.

    Here is what I have at the moment (I’m using CE Image and Time ago plugins)

    <ul class="comments-list">
           {exp:comment:entries channel="news"}
           {exp:member:custom_profile_data}
            <li>{if avatar_filename == ''} 
            /-/images/img04.jpg 
            {/if} 
            {if avatar}
             {exp:ce_img:single src="{avatar_url}" width="32" height="32" alt="{screen_name}'s avatar" class="avatar" rounded_corners="all,2" bg_color="f9f9f9"}
             {/if}
             {/exp:member:custom_profile_data}
             <div class="comment-holder">
              <span class="author"><a href="http://{url}">{name}</a> wrote</span>
              {comment}
              <div class="report-holder">
               <ul class="report">
                <li>{exp:time_ago revert_to_date_format="%d %F %Y"}{comment_date}{/exp:time_ago}</li>
                <li><a href="#">Report ?</a></li>
               </ul>
              </div><!-- div class report-holder ends  -->
             </div><!-- div class comment-holder ends  -->
            </li>
            {/exp:comment:entries}

    Any help would be greatly appreciated! Thanks!

  • #2 / Feb 20, 2012 1:06pm

    Sean C. Smith

    3818 posts

    Hi shorn,

    Sorry to see you are having this trouble. You are wrapping your comment with this tag:  {exp:member:custom_profile_data} but that tag will only display info for the currently logged in member or a specific member provided you pass the member_id=”” parameter.

    If you look at the docs on the comment module:

    All custom member profile fields can be accessed using the “short name” of the field

    What I suggest is removing {exp:member:custom_profile_data} and the closing tag {/exp:member:custom_profile_data} and your avatars should work as expected.

    Sean

     

  • #3 / Feb 20, 2012 2:13pm

    shorn

    79 posts

    Yep, that did it! Thanks!

  • #4 / Feb 24, 2012 10:49am

    Shane Eckert

    7174 posts

    Hello shorn,

    I am happy to hear Sean’s directions got you back in business.

    Let us know if there is anything else you need!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases