We’re having some issues getting the {if avatar} condition to work. Our goal is to have a default image displayed if the user has not set an avatar.
The issue we’re having is that the {if avatar} sometimes works as expected, becoming true when the avatar is set. In other places, however, the conditional is not true with an avatar set. Things seems to change with different users (both tags work on some users, not on others) but remain consistent with that user (the same tag doesn’t work each time).
This one works consistently:
<div class="profile">
{exp:member:custom_profile_data}
...
{if avatar}
<div class="profile-image" url('{avatar_url}'); background-size: cover; background-position: 50% 50%;" alt="{screen_name}'s avatar"></div>
{if:else}
<div class="profile-image" url('{site_url}assets/img/members/profile-placeholder.png'); background-size: cover; background-position: 50% 50%;" alt="{screen_name}'s avatar"></div>
{/if}
...
{/exp:member:custom_profile_data}
</div>
Where this one works with some users, but not with others.
{exp:freemember:update_profile form_id='profile_update' error_handling='inline' error_delimiters='<div class="error">|</div>' member_id="{member_id}"}
{exp:member:custom_profile_data}
...
<div class="small-12 medium-9 view">
{if avatar}
<div class="profile-image" url('{avatar_url}'); background-size: cover; background-position: 50% 50%;" alt="{screen_name}'s avatar"></div>
{if:else}
<div class="profile-image" url('{site_url}assets/img/members/profile-placeholder.png'); background-size: cover; background-position: 50% 50%;" alt="{screen_name}'s avatar"></div>
{/if}
</div>
...
{/exp:member:custom_profile_data}
{/exp:freemember:update_profile}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.