ExpressionEngine Docs

Edit Avatar Tag

Overview

{exp:member:edit_avatar}

This tag allows users to edit their avatar image. The image will be uploaded to Avatar directory as set in Avatar Settings and is required to be less than maximum file size specified in the settings. If the image exceeds maximum width or height, it will be automatically resized.

Parameters

return=

return="member/profile"

Form Inputs

userfile

File input to upload new avatar.

<label for="email">Select file to upload as avatar</label>
<input type="file" name="userfile" />

remove

Submitting the input with this name will remove current avatar.

<input type="button" name="remove" value="Remove avatar" />

Conditionals

if avatar

{if avatar}
    Your current avatar:
    <img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}">
{/if}

The content is shown if the user has an avatar uploaded.

if no_avatar

{if avatar}
    No avatar image.
{/if}

The content is shown if the user does not have an avatar.

Variables

avatar_url

avatar_filename

avatar_width

avatar_height

Example

{exp:member:edit_avatar return="{segment_1}/profile-avatar"}

    Current Avatar:
    {if avatar}
    My avatar: <img src="{avatar_url}" border="0" width="{avatar_width}" height="{avatar_height}" />
    {/if}
    {if no_avatar}No avatar{/if}

    <div>
    Upload an avatar: <input type="file" name="userfile" size="20" class="input" /><br>
    </div>

    <input type='submit' class='submit' value='Upload Avatar' />

    {if avatar}
    <input type='submit' class='submit' value='Remove Avatar' name="remove" />
    {/if}

{/exp:member:edit_avatar}