We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

{if avatar} not returning consitent results

Development and Programming

lifeboatcreative's avatar
lifeboatcreative
76 posts
9 years ago
lifeboatcreative's avatar lifeboatcreative

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}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.