View Full Version : Help: Customise the poster name formating in regard to usergroupid
skerjean
05-17-2002, 05:54 PM
I've hacked the formating of in 'who's online', 'member list', and homepage's 'currently active users' so moderators and admins are shown in a different color.
I now which to do the same in the forum vies and tread view but I can't find where I need to edit the code.
As an example, in forumdisplay.php I changed
$username = $forumuser['username'];
with the following:
if ($forumuser['usergroupid'] == 6 or $forumuser['usergroupid'] == 9) {
$username = "<b><font color=\"EED500\">$forumuser[username]</font></b>";
} else if ($forumuser['usergroupid'] == 5 or $forumuser['usergroupid'] == 7) {
$username = "<b><font color=\"A0A0A0\">$forumuser[username]</font></b>";
} else {
$username = "<b><font color=\"FFFFFF\">$forumuser[username]</font></b>";
}
(Sorry for the lack of indentation but I don't know how you guys do to make formating in a quote...)
Can anyone help me with this?
And by the way, I do not require a complete hack, I just need a hint on where I should look to insert my modifications.
Thanks
Admin
05-18-2002, 06:15 AM
In forumdisplay.php you need to change this:
$forumusers = $DB_site->query("SELECT username, invisible, userid
To this:
$forumusers = $DB_site->query("SELECT username, invisible, userid, usergroupid
usergroupid wasn't selected.
skerjean
05-28-2002, 01:42 PM
I already made that change in forumdisplay.php. I only included this code example to illustrate what I'm trying to do. This code already works for 'users browsing this forum' in forumdisplay.php. What I want to do now is apply the same customization to each post's poster name in showthread.php.
Any clue on that?
Xenon
05-28-2002, 01:45 PM
to mak the changes in showthread you have to edit admin/functions.php
the getpostbit function
skerjean
05-28-2002, 02:44 PM
I see nowhere to edit the username formating in admin/functions.php.
The only thing I found that look a little like it is the following (from line 225):
} else {
$postsperday=0;
$post[username]=$post[postusername];
$post[usertitle]="Guest";
$post[joindate]="Not Yet";
$post[posts]="N/A";
...
which defines the formating for guest users.
I guess this one is more complicated than the previous formating hacks I did. I might need a little more help with it.
Thanks
Xenon
05-28-2002, 04:35 PM
just before the } else { claus add this lines:
if($post[usergroupid]==6) $post[username]="<font color=red>".$post[username]."</font>";
can't be easier ;)
skerjean
05-28-2002, 05:33 PM
Thanks a lot! It works like a charm.
Xenon
05-28-2002, 09:52 PM
np :)
i knew it, because this special thing has been asked two days ago, and i'll wrote this few lines to test it :)
can i give you an advice:
don't make the colors hardcoded. Better get it out from the database from the usergrouptable. so you can change it easier :)
skerjean
05-29-2002, 02:43 PM
I agree, but I think this might be a little beyond my very small programming skills.
In fact, I can't code a thing on my own. I'm barely able to understand some parts of the actual code and make some small modifications to it using cut&paste and some small inputs.
Playing with the database and modifying the admin control panel worries me a lot more than adding a hardcoded text formating line in a couple of places in the code.
So unless you have an easy way to get this done, I'll stick with hardcoded modifications which I understand.
Anyway, thanks a lot for your help.
Xenon
05-29-2002, 03:36 PM
i knew that procedure, but it's the best way to learn coding i think.
thast the way i learned the coding, and sometimes i have to do so once more ;)
but keep it in mind, and try to do it on a local board once you have little more experience.
just think of: the best way to learn is to correct own errors
:)
skerjean
05-29-2002, 03:50 PM
Already got to try this technique a couple of time. I must be on the good track. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.