Version: , by snyx
Developer Last Online: Jan 2013
Version: Unknown
Rating:
Released: 08-20-2002
Last Update: Never
Installs: 0
No support by the author.
Okay, well im trying to colorize the thread starter in forumdisplay based on the usergroup that member is in. The original code in forumdisplay.php is this:
but this only makes all the usernames blue, no matter what group they are in.. what am I doing wrong, a little kick in the right direction would be steller, thanks
-myles
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Originally posted by snyx if ($userinfo['usergroupid'] == '6') {
$thread['postedby'] .= "<a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$thread[postuserid]'><font color='#cc0000'><b><i>$thread[postusername]</i></b></font></a>";
}
else if ($userinfo['usergroupid'] == '7') {
$thread['postedby'] .= "<a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$thread[postuserid]'><font color='green'><b>$thread[postusername]</b></font></a>";
}
else if ($userinfo['usergroupid'] == '5') {
$thread['postedby'] .= "<a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$thread[postuserid]'><font color='green'><b>$thread[postusername]</b></font></a>";
}
else {
$thread['postedby'] .= "<a href='member.php?s=$session[sessionhash]&action=getinfo&userid=$thread[postuserid]'><font color='blue'>$thread[postusername]</font></a>";
}
[/php]
TRY THIS.......i dont know ++++ so back it up....
PHP Code:
if ($loggedin['usergroupid'] == 6 and $highlightadmin) {
$username = "<b><i><font color=red>$loggedin[username]</font></i></b>"; // Color for Admin
} else if (($loggedin['usergroupid'] == 7) and $highlightadmin) {
$username = "<b><font color=darkred>$loggedin[username]</font></b>"; // Color for Supermod
} else if (($mod["$userid"]) and $highlightadmin) {
$username = "<b><font color=green>$loggedin[username]</font></b>"; // Color for Mod
} else {
$username = "<font color=blue>$loggedin[username]</font>"; // Color for normal Member or "Highlight Admin" is turned of
}
and change the values...usergroup ids, colors and ++++
it can't show another color than blue, becaue your variable $userinfo isn't defined in forumdisplay, so the script allways runs the else condition.
you have to add a query to get $userinfo, or it would be impossible:
PHP Code:
if ($thread['postuserid']) {
$userinfo=$DB_site->query_first("SELECT username,usergroupid FROM user WHERE userid=".$thread['postuserid']);
if($userinfo['usergroupid']==6) $color="red";
elseif ($userinfo['usergroupid']==5) $color="green";
else $color="blue";
EEP! 57 queries..
but yeah thx for the shot, but im still not getting any colorednames.. huh they just look normal as if the color wasnt working at all.
Xenon I was wrong, your code was right, you html just off, to colorize links you need to include the font next to the actaully text inside the hyperlink... I tweaked the code to get what I like, thx man, and thx for ur guys help
PHP Code:
if ($thread['postuserid']) {
$userinfo=$DB_site->query_first("SELECT username,usergroupid FROM user WHERE userid=".$thread['postuserid']);
if($userinfo['usergroupid']==6) $special="<font color=#cc0000><b><i>";
elseif ($userinfo['usergroupid']==5) $special="<font color=green><b>";
elseif ($userinfo['usergroupid']==7) $special="<font color=green><b>";
else $special="<font color=blue>";
$threads=$DB_site->query("
SELECT $dotuserid$votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach
FROM thread ".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin WHERE $threadids ORDER BY sticky DESC, $sortfield$sqlsortorder ");
and replace it with:
PHP Code:
$threads=$DB_site->query("
SELECT $dotuserid$votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,thread.lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,user.usergroupid,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach
FROM thread ".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin LEFT JOIN user ON (thread.postuserid = user.userid)
WHERE $threadids ORDER BY sticky DESC, $sortfield$sqlsortorder ");
then you could use $thread[usergroupid] in your if construction and save a lot of extra queries