PDA

View Full Version : Colored usernames in postbit?


snyx
11-27-2002, 09:41 PM
werd, I have been trying to get this to work for ages now, but I cant seem to on 228/229 its werid.

anyone help shed some light on this? I wanna set my users postbit username to a color based on their usergroup. (admins red, mods green, users blue)

I tried this code.. but it just didnt change anything.
no errors, just didnt work.

// ###################### Start coloredusers #######################
$post[specialusername] = $post[username];
$userid=$post[userid];

if ($userid == 6) { $post[specialusername] = "<span color=\"#cc0000\"><i><b>$post[username]</b></i></span>"; }
if ($userid == 11) { $post[specialusername] = "<span color=\"#000000\"><b>$post[username]</b></span>"; }
if ($userid == 10) { $post[specialusername] = "<span color=\"#0000ff\"><b>$post[username]</b></span>"; }
if ($userid == 7) { $post[specialusername] = "<span color=\"green\"><b>$post[username]</b></span>"; }
if ($userid == 2) { $post[specialusername] = "<span color=\"#0000ff\">$post[username]</span>"; }
if ($userid == 5) { $post[specialusername] = "<span color=\"green\"><b><i>$post[username]</i></b></span>"; }
// ###################### End coloredusers #######################

any help anyone can lend me would be huge!
thanks..

-myles

Xenon
11-27-2002, 09:49 PM
you should use this:

// ###################### Start coloredusers #######################
$post[specialusername] = $post[username];

if ($post[usergroupid] == 6) { $post[specialusername] = "<span color=\"#cc0000\"><i><b>$post[username]</b></i></span>"; }
if ($post[usergroupid] == 11) { $post[specialusername] = "<span color=\"#000000\"><b>$post[username]</b></span>"; }
if ($post[usergroupid] == 10) { $post[specialusername] = "<span color=\"#0000ff\"><b>$post[username]</b></span>"; }
if ($post[usergroupid] == 7) { $post[specialusername] = "<span color=\"green\"><b>$post[username]</b></span>"; }
if ($post[usergroupid] == 2) { $post[specialusername] = "<span color=\"#0000ff\">$post[username]</span>"; }
if ($post[usergroupid] == 5) { $post[specialusername] = "<span color=\"green\"><b><i>$post[username]</i></b></span>"; }
// ###################### End coloredusers #######################

and be sure you use $post[specialusername] in your postbit ;)

Velocd
11-27-2002, 09:51 PM
Make sure in your postbit template the code you have listed is not $post[username] but $post[specialusername].

There isn't really any point in creating a new variable, just re-use $post[username] for all the if statements. The code seems to be correct, but you might have just forgot to place something in..

edit: gah, Xenon replies out of no-where :ninja: ;)
Ignore my post, skipped the part referring to usergroup, not userid.

Brian Briscoe
01-07-2003, 11:06 PM
what file do you insert the PHP code into?

Xenon
01-08-2003, 04:10 PM
functions.php getpostbit section

Brian Briscoe
01-08-2003, 08:55 PM
ok i found a section called buildpostbut but no getpostbit, I tried entering that code into that section and that did not work either.

Xenon
01-09-2003, 11:36 AM
the function ist called getpostbit, if you don't find it, you have a corrupted file and your board wouldn't work

Brian Briscoe
01-09-2003, 12:22 PM
Well my board is working becuase im testing it on my home server right now. I am Using ArieSoft WinSyntax as my editor and I did a search through a couple of file for it including admin/functions.php and nothing came up, I even manually searched the file and found nothing. All I can find in 2.2.9 is buildpostbit.

Brian Briscoe
01-09-2003, 12:23 PM
Originally posted by Xenon
the function ist called getpostbit, if you don't find it, you have a corrupted file and your board wouldn't work
Well I guess I could try downloading vBulletin 2.2.9 again, let me do that and ill post again and tell ya if I find anything.

Xenon
01-09-2003, 01:24 PM
lin 57-63 on a unhacked 229 functions.php:

// ###################### Start buildpostbit #######################
$firstnew = 0;
function getpostbit($post) {
// sorts through all the stuff to return the postbit template

// user
global $bbuserinfo,$session,$ignore,$cookietimeout;
there you can see function getpostbit...

and you have to put the code into this function, :)

Brian Briscoe
01-09-2003, 10:39 PM
oh ok man, thanks xenon :)

Xenon
01-10-2003, 10:33 PM
welcome :)

Brian Briscoe
01-11-2003, 07:27 PM
Originally posted by Xenon
welcome :)
heh, thanky :)

theta
03-08-2003, 08:09 AM
I had to change the <span> to <font> for the colors to show up. The <b> and <i> tags worked, but the colors didn't show up with <span>... wierd