vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Staff Avatar Background (https://vborg.vbsupport.ru/showthread.php?t=120582)

Wired1 07-07-2006 05:47 PM

Staff Avatar Background
 
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

1 Attachment(s)
hmmmmmmmm

I'll brb



------------



EDIT

hmmmmmmmm

I'll brb


ok I'm back.

Use this to get you started:

Code:

<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

Quote:

Originally Posted by SkyCatcher
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

1 Attachment(s)
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"


Code:

<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%">&nbsp;</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:


Code:

<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:

Code:

<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:

Code:

<!-- 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%">&nbsp;</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%">&nbsp;</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:

Code:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, expecting `')'' in C:\Inetpub\wwwroot\houseofhelp\v3\includes\adminfunctions_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

Code:

<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">
should be
Code:

<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:

Code:

<!-- 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%">&nbsp;</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%">&nbsp;</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

Quote:

Originally Posted by peterska2
Code:

<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo}, 79)">
should be
Code:

<if condition="$show['avatar'] AND is_member_of({$vbulletin->userinfo[usergroupid]}, 79)">

and

Quote:

Originally Posted by Danny.VBT
Code:

Also using the <if><else /></if> structure would make the code less verbose.

- Result:

Code:

<!-- 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%">&nbsp;</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%">&nbsp;</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
Code:

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 :(

Quote:

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

Quote:

Originally Posted by Allan
Dont' work :(

See my post above :tired:

Allan 07-13-2006 05:48 PM

With this code:
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%">&nbsp;</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%">&nbsp;</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

Code:



<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

Quote:

Originally Posted by SkyCatcher
Code:



<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


Code:


<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):

Code:

$vbphrase[xs_avatar]</phrase>" border="0" /></a>
should be

Code:

</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

1 Attachment(s)
Quote:

Originally Posted by SkyCatcher
Ok, try this. It looks pretty good.

I'm not messing with the if statements right now because my paste arrived :D


Code:


<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

Quote:

Originally Posted by Allan
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.

Code:

<!-- 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

Code:

<!-- 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

Quote:

Originally Posted by Steve M
Code:

<!-- 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 Guest
http://img413.imageshack.us/img413/9738/21ij.gif
  • For moderator
http://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:

Code:


<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

Code:

<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

Quote:

Originally Posted by Wired1
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:

Code:


<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

Quote:

Originally Posted by peterska2
Code:

<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 :)

Code:

<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

Quote:

Originally Posted by peterska2
Ok, I got it :)

Code:

<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/sh...ad.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?

Code:

<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

Quote:

Originally Posted by slappy
Something like this?

Code:

<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!


All times are GMT. The time now is 04:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01583 seconds
  • Memory Usage 1,937KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (32)bbcode_code_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete