View Full Version : Staff Avatar Background
Wired1
07-07-2006, 05:47 PM
Split off of this discussion:
https://vborg.vbsupport.ru/showthread.php?t=119470
So what do I mean? Take a look at the admin / mods right here!
The general idea is to enable certain members to have a background for their avatar, like the staff here do. Basing this on usergroups would probably be the easiest way. Keep in mind if someone is part of two or more usergroups that are able to have a special background, the end user and/or staff members need to be able to set which background is appropriate for said user. A hierarchy (e.g. a value for each background) could also be set up (managed by staff of course, with optional overrides) to automate this process.
Some forums may not want their mods to be noted as such when outside of the sub-forums they moderate, and as such may want an option to have them automatically not show the background in certain forums.
The avatar the user chooses preferably should not be modified by the hack, in case of the person being demoted, or the background being used as a contest prize on the forum, etc. The hack could use GD or something to combine the background and the user's avatar into a new one (if needed, I'd recommend storing a copy of the original avatar somewhere in the server or database for backup purposes), but not to replace the avatar direcly within the user's profile. Something like a conditional statement around the avatar block in a post to resolve all of this. Or, a conditional could be used to place the background around the avatar assuming the appropriate conditions are met. No merging of files needed. GD may be used if an optional idea for the hack is used where their name is on the avatar like vB.org, although the name may not necessarily match the user name, akin to here.
A nice add-on to this hack would be an ACP area where a staff member can give someone a background for a limited amount of time to support the contest idea.
Showing all possible avatars within their UserCP and member page would be nice as well.
Mr. Slugworth
07-11-2006, 03:05 AM
It would be great if this could be based on usergroups or post counts, so a member make 5,000 points, they get a special background of frame or something. Great request, been looking for something like this for months.
Wired1
07-11-2006, 04:34 AM
Are there hacks where a user is placed into a secondary usergroup if x # of posts has been hit?
a simple fa?ade
07-11-2006, 02:34 PM
You don't need a hack, just create the usergroup and the promotion for it.
SkyCatcher
07-11-2006, 10:35 PM
hmmmmmmmm
I'll brb
------------
EDIT
hmmmmmmmm
I'll brb
ok I'm back.
Use this to get you started:
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100" height="100" align="center">
<tr>
<td background="http://probetreffen.de/forum/images/ranks/btn_moderator.gif" nowrap="nowrap" no-repeat><center><img src="$post[avatarurl]" height="50" width="50"</center></td>
</tr>
</table>
<br />
I'm too tired to make this but it's interesting to say the least.
Here's what you do....
Create a 100x100 pixel image you'd like to use as a background. (replace my code http://probetreffen.de/forum/images/ranks/btn_moderator.gif with your background image)
This will give you a 100x100 background and a 50x50 avatar ontop of that, centered.
That's the easy part :p
Now for the hard part:
You have to set conditionals for usergroups.
If administrator > use this background image and his avatar
if moderator > use this image and avatar etc..
then another conditional where you say if usergroupid != "1" & !="2" etc (all the admin and mod groups)
display normal avatar.
Basically you're saying that if the user is a staff member, the normal avatar won't show up, but instead the background and his avatar will.
And if it's a normal user then just display the avatar.
It's really not that complicated but it's a little work. You should create a plugin and template to hold all the code and then call the variable within the postbit template.
I've attached a quick demo screenshot:
1st is the name, then the user rank, then the background and avatar, then the normal avatar.
Wired1
07-12-2006, 03:34 AM
Now for the hard part:
You have to set conditionals for usergroups.
If administrator > use this background image and his avatar
if moderator > use this image and avatar etc..
then another conditional where you say if usergroupid != "1" & !="2" etc (all the admin and mod groups)
display normal avatar.
something like <if primary / secondary usergroup = number> </if>
that's cake, but the centering (or off centering in the case of vBulletin.org) is the part I'm not sure about.
Zachariah
07-12-2006, 04:45 AM
You can use if conditional usergroup setting on: "badge.png"
- If usergroup 1 user image background "badge.png"
- If usergroup 2 user image background "badge2.png"
- If usergroup 3 user image background "badge3.png"
- If usergroup 4 user image background "badge4.png"
<table border="0" cellpadding="0" cellspacing="0" width="124" height="82">
<tr>
<td width="124" background="badge.png" height="82">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="60">
<tr>
<td width="50%"> </td>
<td width="50%"><img border="0" src="$post[avatarurl]" width="60" height="60"></td>
</tr>
</table>
</td>
</tr>
</table>
Wired1
07-13-2006, 04:29 AM
Ok, so I went into the postbit and found:
<if condition="$show['avatar']"><td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if>
formatted better:
<if condition="$show['avatar']">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" />
</a>
</td>
</if>
attempted to replace it with:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<table border="0" cellpadding="0" cellspacing="0" width="200" height="200">
<tr>
<td width="200" background="badge.png" height="200">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="125">
<tr>
<td width="25%"> </td>
<td width="50%"><img src="$post[avatarurl]" width="125" height="125" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></td>
<td width="25%"> </td>
</tr>
</table>
</td>
</tr>
</table>
$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<if condition="$show['avatar'] AND !is_member_of({$vbulletin->userinfo}, 79)">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Get this error though:
The following error occurred when attempting to evaluate this template:
Parse error: parse error, expecting `')'' in C:\Inetpub\wwwroot\houseofhelp\v3\includes\adminfu nctions_template.php(3537) : eval()'d code on line 44
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
So, what stupid little thing did I pooch?
SkyCatcher
07-13-2006, 07:11 AM
AND is_member_of({$vbulletin->userinfo}, 79)
??????
peterska2
07-13-2006, 08:48 AM
<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">should be<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo[usergroupid]}, 79)">
Guest190829
07-13-2006, 08:59 AM
Also using the <if><else /></if> structure would make the code less verbose.
Wired1
07-13-2006, 05:29 PM
Didn't work either, but it's a but more concise:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar']">
<if condition="is_member_of({$vbulletin->userinfo[usergroupid]}, 79)">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<table border="0" cellpadding="0" cellspacing="0" width="200" height="200">
<tr>
<td width="200" background="badge.png" height="200">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="125">
<tr>
<td width="25%"> </td>
<td width="50%"><img src="$post[avatarurl]" width="125" height="125" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></td>
<td width="25%"> </td>
</tr>
</table>
</td>
</tr>
</table>
$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
<else />
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase
1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Allan
07-13-2006, 05:32 PM
<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">should be<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo[usergroupid]}, 79)">
and
Also using the <if><else /></if> structure would make the code less verbose.
- Result:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<table border="0" cellpadding="0" cellspacing="0" width="200" height="200">
<tr>
<td width="200" background="badge.png" height="200">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="125">
<tr>
<td width="25%"> </td>
<td width="50%"><img src="$post[avatarurl]" width="125" height="125" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></td>
<td width="25%"> </td>
</tr>
</table>
</td>
</tr>
</table>
$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<else />
<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo[usergroupid]}, 79)">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<!-- END - TEST FOR AVATAR HACK -->
it's ok for you ?
SkyCatcher
07-13-2006, 05:37 PM
[QUOTE=Allan]
You've still got
AND is_member_of({$vbulletin->userinfo}, 79)">
In your results code window.
Why not just do something like
<if condition="$vbulletin->userinfo[usergroupid]=6">
bla bla
<if condition="$vbulletin->userinfo[usergroupid]=2">
etc
and make a plugin to hold the code so the template doesn't get cluttered
I'm sure you could use something like
<if condition="$vbulletin->userinfo[usergroupid]=6 || $vbulletin->userinfo[usergroupid]=7 || $vbulletin->userinfo[usergroupid]=11">
Allan
07-13-2006, 05:40 PM
Dont' work :(
Parse error: syntax error, unexpected '{', expecting ')' in /home/**********/www/forum/includes/adminfunctions_template.php(3563) : eval()'d code on line 36
SkyCatcher
07-13-2006, 05:42 PM
Dont' work :(
See my post above :tired:
Allan
07-13-2006, 05:48 PM
With this code:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]">
<table border="0" cellpadding="0" cellspacing="0" width="122" height="80">
<tr>
<td width="122" background="$stylevar[imgdir_misc]/badge.png" height="80">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="60">
<tr>
<td width="25%"> </td>
<td width="50%"><img src="$post[avatarurl]" width="60" height="60" alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></td>
<td width="25%"> </td>
</tr>
</table>
</td>
</tr>
</table>
$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<else />
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Result: (lol)
http://img180.imageshack.us/img180/5270/result2hp.gif
SkyCatcher
07-13-2006, 05:52 PM
<if condition="$show['avatar'] & $vbulletin->userinfo[usergroupid]=6">
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="122" height="80" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><center><img src="$post[avatarurl]" height="60" width="60"</center></td>
</tr>
</table>
<br />
</if>
Try that. I don't know where all the extra crap came from.
Allan
07-13-2006, 05:59 PM
<if condition="$show['avatar'] & $vbulletin->userinfo[usergroupid]=6">
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="122" height="80" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><center><img src="$post[avatarurl]" height="60" width="60"</center></td>
</tr>
</table>
<br />
</if>
Try that. I don't know where all the extra crap came from.
Nop ..
http://img401.imageshack.us/img401/6864/yep0kc.gif
Allan
07-13-2006, 06:16 PM
Tested and don't work :(
SkyCatcher
07-13-2006, 06:42 PM
Ok, try this. It looks pretty good.
I'm not messing with the if statements right now because my paste arrived :D
<br />
<table class="alt2" cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
<br />
Wired1
07-13-2006, 07:16 PM
BTW, there was a small problem with my code (extra bit):
$vbphrase[xs_avatar]</phrase>" border="0" /></a>
should be
</a>
still didn't work, but it explains what happened w/ Alan's attempt.
Can you make a whole table a hyperlink though? I think you can.
Allan
07-13-2006, 07:19 PM
Ok, try this. It looks pretty good.
I'm not messing with the if statements right now because my paste arrived :D
<br />
<table class="alt2" cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
<br />
Always not :surprised:
SkyCatcher
07-13-2006, 07:22 PM
Always not :surprised:
LOL! Ok I quit. I'm using postbit_legacy and the code looks ok there... it'll have to be changed for the postbit since the table structure is different.
Mythotical
07-13-2006, 07:28 PM
Allan, you need to set the avatar to the far right behind the background, so basically set the background to load after the avatar or set the avatar to load as the background, I don't know, I plan to give it a go once my new server is setup.
Wired1
07-13-2006, 07:44 PM
What about this? (don't have the background uploaded to my server yet, just putzing around at work w/ limited access to forum)
I basically just tweaked Sky's code and slapped a basic conditional around it. repositioning the background and the avatar are easy w/ this code, just want to make sure it doesn't interfere w/ vB stuff.
<!-- START -->
<if condition="$show['avatar']">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
</if>
<!-- END -->
Just tested it, looked ok (remoted home), although I THINK it blew up the avatars that were less than the height / width, but that can be fixed.
Mythotical
07-13-2006, 08:07 PM
<!-- START -->
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<!-- END -->
Try that code Wired. I try to avoid using double if conditions as it looks messy imo.
Allan
07-13-2006, 08:19 PM
<!-- START -->
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
<!-- END -->
Try that code Wired. I try to avoid using double if conditions as it looks messy imo.
It work Almost ....
Some group one the background while just the admin should have it.
looking:
For me, usergroup Administrator:http://img413.imageshack.us/img413/6299/17fg.gif
For Guesthttp://img413.imageshack.us/img413/9738/21ij.gif
For moderatorhttp://img248.imageshack.us/img248/5715/35cj.gif
Wired1
07-13-2006, 08:30 PM
small problem with that code is that someone isn't in that group, it won't go through <if condition="$show['avatar']> by itself.
here's what I was messing with:
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=79">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="./images/test_badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
</if>
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]!=79">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
peterska2
07-13-2006, 09:05 PM
<if condition="$show['avatar']">
<if condition="$vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Allan
07-13-2006, 09:11 PM
small problem with that code is that someone isn't in that group, it won't go through <if condition="$show['avatar']> by itself.
here's what I was messing with:
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]=79">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="./images/test_badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
</if>
<if condition="$show['avatar'] AND $vbulletin->userinfo[usergroupid]!=79">
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
Yes, it work, but there are one problem, every members have the backgroup now (all usergroup) :p
<if condition="$show['avatar']">
<if condition="$vbulletin->userinfo[usergroupid]=6">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Work also, but even problem as my post before
peterska2
07-13-2006, 09:42 PM
Ok, I got it :)
<if condition="$show['avatar']">
<!-- check for admin -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<!-- I am not an admin so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Allan
07-13-2006, 09:49 PM
Ok, I got it :)
<if condition="$show['avatar']">
<!-- check for admin -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<!-- I am not an admin so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Yesss, it work perfectly, thank Peterska2 ;)
But, if i want add other images for other usergroup, How may I make ?
peterska2
07-13-2006, 09:52 PM
As many as you want. You can nest the if statements by having it in the format:
if admin
else if super mod
else if mod
else if custom group
else normal
end if
end if
end if
end if
Basically just keep nesting them.
If you want two or more groups to use the same image, then you can use an array in the conditional to specify which groups that conditional applies to.
Wired1
07-13-2006, 09:53 PM
Schweet :) Going to try tweaking it w/ standard vBulletin code so that if different usergroups have different avatar dimensions the hole will stretch. currently it'll smush the avatar.
Example:
http://www.houseofhelp.com/forums/showthread.php?t=52133
peterska2
07-13-2006, 09:54 PM
you can do that by using conditional nesting and using different dimensions in the code from there
slappy
07-13-2006, 10:01 PM
Something like this?
<if condition="$show['avatar']">
<!-- check for admin -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<if condition="$post[usergroupid]==X">
<!-- I am in this usergroup so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge2.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<!-- I am not in either of those groups so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
</if>
Oops. Look like the else needs to be else/if .
peterska2
07-13-2006, 10:04 PM
Something like this?
<if condition="$show['avatar']">
<!-- check for admin -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<if condition="$post[usergroupid]==X ">
<!-- I am in this usergroup so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge2.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<!-- I am not in either of those groups so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Oops. Look like the else needs to be else/if .
Nope, you just need another </if> on the end :)
slappy
07-13-2006, 10:09 PM
Yep. I was adding it while you were correcting my omission. :cool:
Thanks.
Is the use of the else / if considered better formatting?
Regards,
SkyCatcher
07-13-2006, 10:11 PM
lol I love it, total chaos!
How many designers and coders does it take to come up with a tiny piece of functional code lol.
It's really starting to shape up, but I thought about having the small avatar in behind the background image as was mentioned... it's frying my brain....
you have a table
--------------------------table--------------------------|
tablerow top---------------------------------------TR-| |
|............................columntop -------------------TD|.| |
|...........................................|..... ........................|.| |
|...........................................|..... ........................|.| |
|...........................................|---------------------|.| |
tablerowbottom-----------------------------------</tr>| |
--------------------------table--------------------------|
How the hell would you be able to pull it off? I mean, you can't have the column without a table to hold it and you can't add a table because then the 2nd table will not overlap the 1st but instead be to the right or below it....
BRAIN FRYING!
peterska2
07-13-2006, 10:15 PM
Yep. I was adding it while you were correcting my omission. :cool:
Thanks.
Is the use of the else / if considered better formatting?
Regards,From the vB ManualvBulletin template conditionals do not natively support 'else if', but you can easily replicate its behavior by nesting conditionals as follows:<if condition="$my_variable == 1">
<p>My variable is equal to one.</p>
<else />
<if condition="$my_variable == 2">
<p>My variable is equal to two.</p>
<else />
<p>My variable is equal to neither one nor two.</p>
</if>
</if>
Wired1
07-13-2006, 10:21 PM
Ok, now to get complicated. I THINK this can be done with some CSS and DIVs, not sure.
Having the badge.png overlay the avatar so that you keep the rounded edges of the inside box (assuming that's what people use when they create their own badges). Either way the overlay can help hide the fact that some avatars are different sizes (or at least help you from making a badge for EVERY avatar size).
That would also allow for better positioning, as for right now, it's not REALLY in position. You could use some creative table and cell creation to force it there, but with multiple usergroups and avatar sizes that'd quickly become a pain in the side.
slappy
07-13-2006, 10:23 PM
Thanks Kerry-Anne:
I was thinking of the javascript structure:
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time<10)
{
document.write("<b>Good morning</b>")
}
else if (time>=10 && time<16)
{
document.write("<b>Good day</b>")
}
else
{
document.write("<b>Hello World!</b>")
}
</script>
<p>
This example demonstrates the if..else if...else statement.
</p>
Still have alot to learn. :D
Regards,
Wired1
07-13-2006, 10:39 PM
FYI I've made a post at WDF for help for potential CSS solutions to my new question concerning CSS layers and the like:
http://www.webdesignforums.net/showthread.php?t=24578
Now for this hack we've all worked on to kick some booty, some type of backend that would easily allow you to assign badges to usergroups would rock, w/ some dynamic code that'd create some/all of the conditionals. AdminCP stuff. Yes, this is way out of my forte :)
Allan
07-14-2006, 09:56 AM
For you if you want ^^ :
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
For team :
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
Code:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar']">
<!-- ADMIN -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge6.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- ADMIN -->
<else />
<!-- MODERATOR -->
<if condition="$post[usergroupid]==7 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge7.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- MODERATOR -->
<else />
<!-- SUPER MODERATOR -->
<if condition="$post[usergroupid]==5 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge5.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- SUPER MODERATOR -->
<else />
<!-- CODER -->
<if condition="$post[usergroupid]==10 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge10.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- CODER -->
<else />
<!-- TRANSLATOR -->
<if condition="$post[usergroupid]==9 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge9.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- TRANSLATOR -->
<else />
<!-- NO GROUP -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
<!-- NO GROUP -->
</if>
</if>
</if>
</if>
</if>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Smiry Kin's
07-14-2006, 12:17 PM
Something like this?
<if condition="$show['avatar']">
<!-- check for admin -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<if condition="$post[usergroupid]==X ">
<!-- I am in this usergroup so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="124" height="82" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge2.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="64" width="59" align="right"></td>
</tr>
</table>
</td>
<else />
<!-- I am not in either of those groups so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
</if>
Oops. Look like the else needs to be else/if .
doesnt seem to work.. i get this..
http://img55.imageshack.us/img55/1563/nofitnorepeat6bq.jpg
dont care to much about it being out of postition, but i just dont see why the no repeat isnt working.
peterska2
07-14-2006, 12:24 PM
You need to adjust the height and width settings for the size of the badge that you are using.
Allan
07-14-2006, 12:39 PM
You need to adjust the height and width settings for the size of the badge that you are using.
No, it's size to avatar Which is too big
peterska2
07-14-2006, 12:46 PM
Yes but the table height and width need to match the images.
Wired1
07-14-2006, 01:38 PM
Gotta love that we've got an admin that is the ONLY person on the board who has a large avatar, 125x125. Yep, it's an animated gif. No, can't make them change it. Bastid.
One guy @ WDF said this:
I would probably put two img elements in one div (or two divs with a background in one div, whichever) and layer them over each other with absolute positioning + z-index to specify which is on top. Alternatively, put them in the right order. The point is, use two elements instead of just the one. Alternatively, you can do it the same way it is right now, except with the thing you want in the whole as a background. Then use the background-position property to put the avatar where it needs to go.
This help anyone?
Allan
07-14-2006, 02:33 PM
Another problem, the avatar to members don't show :surprised:
Wired1
07-14-2006, 03:22 PM
odd, I was testing w/ a local user, worked fine for me.
Allan
07-14-2006, 03:26 PM
Do you have same code to me ? (post top)
can you put your code here which I compare ?
Wired1
07-14-2006, 06:26 PM
it's pretty much like what slappy posted, except I don't have an extra space after the groupid # like he does:
<if condition="$post[usergroupid]==X ">
When I get home I'll post my code. If you want to see it in action, got to the house of help (in sig), go to off topic forum near the top. You'll see a test thread there. I believe I still have the code active (can't see site from work).
slappy
07-14-2006, 06:34 PM
Oops. That space was just because I took out a groupid number and replaced it with an "X". The space should not be there. The original was:
<if condition="$post[usergroupid]==6">
I'll fix my example code now.
Regards,
Allan
07-14-2006, 07:01 PM
it's pretty much like what slappy posted, except I don't have an extra space after the groupid # like he does:
<if condition="$post[usergroupid]==X ">
When I get home I'll post my code. If you want to see it in action, got to the house of help (in sig), go to off topic forum near the top. You'll see a test thread there. I believe I still have the code active (can't see site from work).
Ok, thanks ;)
Same problem, avatar members don't show
Same problem, avatar members don't show
I have find !!
One was missing an <else /> at the end, before no usergroup :banana:
Bubble #5
07-15-2006, 10:53 PM
What is it that you guys are trying to do? Posting a background image per usergroup is already a hack :bunny:
slappy
07-15-2006, 11:03 PM
Reading from the top would enlighten you that this thread is about using the vbulletin staff avatar, with the cutout for a photo or private avatar image added, or with just the staff title of the appropriate usergroup, at the choice of the staff member.
Various options and code to accomplish placement and alignment of the staff avatars, as used here with inserts, were discussed, as was custom vbulletin staff avatars and the code to display them correctly by usergroup.
Regards,
Wired1
07-18-2006, 01:56 AM
so, does anyone have any improvements to make on this?
peterska2
07-21-2006, 01:35 PM
This is the version that I have working on my site. It's still done with tables, but it works perfectly and each staff member has their own badge too.
I made a couple of adjustments to get the alignment right with my badges though. If anyone needs a plain PSD template to work with these instructions, then just let me know and I'll fix it up for you.
<if condition="$show['avatar']">
<!-- check for staff -->
<if condition="in_array($post[usergroupid], array(5,6,7))">
<!-- I am staff so do this -->
<td class="alt2">
<table cellpadding="4" cellspacing="0" border="0" width="124" height="82" align="center" background="images/$post[username]_avatar.gif" nowrap="nowrap" no-repeat>
<tr>
<td width="48%"> </td>
<td><img src="$post[avatarurl]" height="56" width="56" align="center"></td>
</tr>
</table>
</td>
<else />
<!-- I am not staff so do this -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
</if>
</if>
Wired1
07-21-2006, 04:09 PM
PSD would be great.
Why not use $post[avwidth] $post[avheight] in the staff avatar though?
My only gripe with what we've come up so far is with avatars of varing size. Mine's 47x50, another guy's got 48x50, etc. Gotta make a big one for the guy who has a 125x125 somehow though :) Isn't there a way through PHP GD to do image manipulation?
peterska2
07-21-2006, 04:16 PM
Thats why I specified the size in there. It adjusts the size of the avatar to fit the badge.
If you want to take a look at them in use on my site, you will see that they have been shrunk significantly to fit the badges.
FYI, the original size avatars in use by me and my co-admin are attached.
My moderator does not have an avatar so his badge does not show.
I'll sort the basic PSD file out later and post it up as a release with everyone who has contributed as co-authors.
Snyper
07-21-2006, 04:32 PM
Hello Allan,
great, can you post the psd and Font ????
Greets :D
For you if you want ^^ :
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
For team :https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
https://vborg.vbsupport.ru/
Code:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar']">
<!-- ADMIN -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge6.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- ADMIN -->
<else />
<!-- MODERATOR -->
<if condition="$post[usergroupid]==7 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge7.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- MODERATOR -->
<else />
<!-- SUPER MODERATOR -->
<if condition="$post[usergroupid]==5 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge5.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- SUPER MODERATOR -->
<else />
<!-- CODER -->
<if condition="$post[usergroupid]==10 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge10.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- CODER -->
<else />
<!-- TRANSLATOR -->
<if condition="$post[usergroupid]==9 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge9.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- TRANSLATOR -->
<else />
<!-- NO GROUP -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
<!-- NO GROUP -->
</if>
</if>
</if>
</if>
</if>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Wired1
07-31-2006, 03:30 AM
I'll sort the basic PSD file out later and post it up as a release with everyone who has contributed as co-authors.That'd be cool :)
peterska2
07-31-2006, 03:51 AM
I'll get it sorted out shortly.
Just need to tidy up the PSD I'm using.
peterska2
07-31-2006, 06:55 AM
Here we go: Staff avatars (https://vborg.vbsupport.ru/showthread.php?t=122623)
Allan
07-31-2006, 07:31 AM
Hello Allan,
great, can you post the psd and Font ????
Greets :D
Check Mp ;)
Digitalus
12-19-2006, 08:18 PM
For you if you want ^^ :
http://img208.imageshack.us/img208/8388/exemple13bp.png
https://vborg.vbsupport.ru/
For team :
http://img48.imageshack.us/img48/4491/badgeadmin8fm.png
http://img48.imageshack.us/img48/8396/badgesupermoderator7bd.png
http://img83.imageshack.us/img83/4403/badgemoderator5oi.png
http://img228.imageshack.us/img228/9082/badgecoder8fb.png
http://img83.imageshack.us/img83/6032/badgetranslator6hy.png
Code:
<!-- START - TEST FOR AVATAR HACK -->
<if condition="$show['avatar']">
<!-- ADMIN -->
<if condition="$post[usergroupid]==6">
<!-- I am an admin so do this -->
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge6.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- ADMIN -->
<else />
<!-- MODERATOR -->
<if condition="$post[usergroupid]==7 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge7.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- MODERATOR -->
<else />
<!-- SUPER MODERATOR -->
<if condition="$post[usergroupid]==5 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge5.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- SUPER MODERATOR -->
<else />
<!-- CODER -->
<if condition="$post[usergroupid]==10 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge10.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- CODER -->
<else />
<!-- TRANSLATOR -->
<if condition="$post[usergroupid]==9 ">
<td class="alt2">
<table cellpadding="5" cellspacing="0" border="0" width="150" height="70" align="center">
<tr>
<td background="$stylevar[imgdir_misc]/badge9.png" nowrap="nowrap" no-repeat><img src="$post[avatarurl]" height="56" width="56" align="right"></td>
</tr>
</table>
</td>
<!-- TRANSLATOR -->
<else />
<!-- NO GROUP -->
<td class="alt2">
<a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
</td>
<!-- NO GROUP -->
</if>
</if>
</if>
</if>
</if>
</if>
<!-- END - TEST FOR AVATAR HACK -->
Allan,
Can you upload the PSD file and the fonts please?
Thanks...
KristerSwe
01-07-2007, 04:48 PM
Hello all.
Am new about this and like this mod alot and can someone
provide us newbies with a How to and final code for this
wonderful hack ...
Thanks " "Hat off"Ladies and gentlemen"Well done"
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.