x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Member Avatars

Question: How can I add the member avatars to my comments

Answer:

{if avatar}
<img class="avatar" src="{avatar_url}"
width="{avatar_width}" height="{avatar_height}" alt="{name}" title="{name}" />
{/if}

Linebreaks inserted, make sure you remove them first. =)

Question: How can I display a default avatar if the comment author doesn’t have one uploaded

Answer:

{if avatar_filename == ''}
<img src="<nowiki>http://www.yourdomain.com/your_default_avatar.gif</nowiki>" width="50" height="50" alt="Avatar for {name}" class="avatar" />
{/if}
{if avatar}
<img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}" alt="Avatar for {name}" class="avatar" />
{/if}

To display a Gravatar as the default:

{if avatar_filename == ''}
<img src="{exp:gravatar rating="R" size="50"
email="
{email}" default="http://www.yourdomain.com/gravatar.gif"}" width="50" height="50" alt="Gravatar for {name}" class="avatar" />
{/if}

{if avatar}
<img src="{avatar_url}" width="{avatar_width}"
height="{avatar_height}" alt="Avatar for {name}" class="avatar" />
{/if}

Question: How can I display a Gravatar or default avatar for a non-logged in user

Answer:

Check to see if the author_id is ‘0’, then display the Gravatar using this code:

{if author_id == "0"}
[code]
<img src="{exp:gravatar rating="R" size="50"
email="
{email}" default="http://www.yourdomain.com/gravatar.gif"}" width="50" height="50" alt="Gravatar for {name}" class="avatar" />

{/if}

This is causing Parse errors. Trying to figure this out.

Category:Templates

Categories: