The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Show avatar on header
Hello,
I'm trying to do this: So when the user is logged in, he will see his avatar, when the user is not logged, it will show a default one. This is the code I made: Code:
<if condition="is_member_of($bbuserinfo, 1, 3)"> <if condition="$show['avatar']"> <a href="member.php?$session[sessionurl]u=$post[userid]"> <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a> </if> </else> <img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> Thank you for your help in advance. |
#2
|
|||
|
|||
Code:
<if condition="!is_member_of($bbuserinfo, 1, 3)"> <if condition="$show['avatar']"> <a href="member.php?$session[sessionurl]u=$post[userid]"> <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a> </if> </else> <img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> |
#3
|
||||
|
||||
I think it would better to use this:
Code:
<if condition="$show['member'] AND $show['avatar']"> <a href="member.php?$session[sessionurl]u=$post[userid]"> <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a> <else /> <img src="defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> Btw, make sure you use <else /> and not</else> |
#4
|
|||
|
|||
Thank you,
I try it both and keep showing to me the code after <else />, I'm trying it has an administrator and has a register user, however in both I can't see my avatar. Both of users have avatar...This is the code: HTML Code:
<div style="float: left; width: 50px; margin: 6px;"> <if condition="$show['member'] AND $show['avatar']"> <a href="member.php?$session[sessionurl]u=$post[userid]">133 <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" width="48" height="48" border="0" /></a> <else /> 789<img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> </div> HTML Code:
<if condition="!is_member_of($bbuserinfo, 1, 3)"> <img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> <else /> <if condition="$show['avatar']">avatar <a href="member.php?$session[sessionurl]u=$post[userid]"> <img src="$post[avatarurl]" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar] </phrase> " width="48" height="48" border="0" /></a> </if> </if> What I'm doing wrong? Thank you both! --------------- Added [DATE]1207684906[/DATE] at [TIME]1207684906[/TIME] --------------- Hello, I have a update: HTML Code:
<if condition="!is_member_of($bbuserinfo, 1, 3)"> <a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="$prepared[avatarurl]" alt="<phrase 1="$bbuserinfo[username]">$bbuserinfo[username]</phrase>" width="48" height="48" border="0" /></a> <else /> <img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> |
#5
|
||||
|
||||
I'm having the same problem with the code, with the image not working through the code is correct. I've narrowed it down to this:
PHP Code:
That just doesn't want to work in header template. Anyone know why? Anyone know a workaround? Pretty please? |
#6
|
|||
|
|||
Hello MarkJW,
I found a way to work: HTML Code:
<if condition="!is_member_of($bbuserinfo, 1, 3)"> <a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]"><img src="$navbar_ava[0]" alt="<phrase 1="$bbuserinfo[username]">$bbuserinfo[username]</phrase>" width="48" height="48" border="0" /></a> <else /> <img src="$stylevar[imgdir_misc]/defaultavatar.gif" alt="Avatar" width="48" height="48" border="0" /> </if> https://vborg.vbsupport.ru/showthread.php?t=83053 If you do this it will show the avatar in your header. Hope it helps you! |
#7
|
||||
|
||||
Oh wow, thanks!
Edit: this is the conditional I used and it's working very well for me. Thanks guys! PHP Code:
|
#8
|
|||
|
|||
You're welcome, tell me what you want to do? The variable you use isn't correct, if you are trying to only show the avatar to the register members, use the suggestion given by GameWizard:
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|