Default avatar conditional question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Don Maddox
    Senior Member
    • Aug 2002
    • 152
    • 3.6.x

    Default avatar conditional question

    I'm using the following code to display default avatars:

    Code:
     
    <if condition="$show['avatar']"><div>
       <table><tr><td>
       <a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
       </if>
       </td></tr>
       </table></div>
     
       <else />
     
        <if condition="$bbuserinfo[showavatars]">
         <div class="smallfont">
         <table><tr><td><div align="center">
          <img src="[URL]http://www.myurl.com/forums/images/default_avatar.gif[/URL]" alt="No avatar selected. Visit your User CP to select an avatar." border="0" />
          </div>
          </td></tr></table>
         </div>
       </if>
    </if>
    As written, this code displays a default avatar for any user who has not yet selected one. But what I want to do is display the default avatar only to the user, not to every member of the forum.

    In other words, if you had not yet selected an avatar you would see the default beside your own posts. But you would not see a default avatar beside the posts of every other member who has not yet selected one.
    http://www.gamesquad.com
  • peterska2
    Senior Member
    • Oct 2003
    • 8869
    • 3.7.x

    #2
    Code:
     
    <if condition="$show['avatar']"><div>
       <table><tr><td>
       <a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
       </if>
       </td></tr>
       </table></div>
     
       <else />
     
        <if condition="$bbuserinfo[userid] == $post[userid]">
         <div class="smallfont">
         <table><tr><td><div align="center">
          <img src="http://www.myurl.com/forums/images/default_avatar.gif" alt="No avatar selected. Visit your User CP to select an avatar." border="0" />
          </div>
          </td></tr></table>
         </div>
       </if>
    </if>
    That should do the trick. You were going along the right lines but your conditional for the default one was incorrect.

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎