skinny Posted December 13, 2008 Posted December 13, 2008 At the moment i have it so that Admins are red, Donators are yellow and non donators gray But i would like to add into it a colour for mods---blue When i just add this {if($r['user_level'] ==5){ $r['username'] = "<a title='Moderator' href='viewuser.php?u={$r['userid']}'><font color=blue>{$r['username']}</font>";} before the first user level if statement it doesnt show the HOF no more Is there an easier way/ or a way to make it so i can have seperate colours for mods Any help is greatly appreciated Thanks :-) This is the functioning code function hof_level() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest levels <table width=75% cellspacing=1 class='table2'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY level DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { if($r['user_level'] ==2){ $r['username'] = "<a title='Admin' href='viewuser.php?u={$r['userid']}'><font color=red>{$r['username']}</font>";} {$d=""; if($r['donatordays']) { $r['username'] = "[url='viewuser.php?u={$r[']<font color='yellow'>[b]{$r['username']}[/b][/url][/b]</font>"; } } $p++; if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>[url='viewuser.php?u={$r[']<a href='gangs.php?action=view&ID={$r['gang']}'>[b][{$r['gangPREF']}][/b][/url][url='viewuser.php?u={$r['] <font color='gray'>[b]{$r['username']}[/b][/url]</td><td>$t{$r['level']}$et</td> </tr>"; } print "</table>"; } Quote
BlueDevil23 Posted December 13, 2008 Posted December 13, 2008 Re: HOF-- User level Colours At the moment i have it so that Admins are red, Donators are yellow and non donators gray But i would like to add into it a colour for mods---blue When i just add this {if($r['user_level'] ==5){ $r['username'] = "<a title='Moderator' href='viewuser.php?u={$r['userid']}'><font color=blue>{$r['username']}</font>";} before the first user level if statement it doesnt show the HOF no more Is there an easier way/ or a way to make it so i can have seperate colours for mods Any help is greatly appreciated Thanks :-) This is the functioning code function hof_level() { global $db,$ir,$c,$userid, $myf; print "Showing the 20 users with the highest levels <table width=75% cellspacing=1 class='table2'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>"; $q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY level DESC,userid ASC LIMIT 20"); $p=0; while($r=$db->fetch_row($q)) { if($r['user_level'] ==2){ $r['username'] = "<a title='Admin' href='viewuser.php?u={$r['userid']}'><font color=red>{$r['username']}</font>";} {$d=""; if($r['donatordays']) { $r['username'] = "[url='viewuser.php?u={$r[']<font color='yellow'>[b]{$r['username']}[/b][/url][/b]</font>"; } } $p++; if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>[url='viewuser.php?u={$r[']<a href='gangs.php?action=view&ID={$r['gang']}'>[b][{$r['gangPREF']}][/b][/url][url='viewuser.php?u={$r['] <font color='gray'>[b]{$r['username']}[/b][/url]</td><td>$t{$r['level']}$et</td> </tr>"; } print "</table>"; } Find this line: if($r['donatordays']) { $r['username'] = "[url='viewuser.php?u={$r[']<font color='yellow'>[b]{$r['username']}[/b][/url][/b]</font>"; } add under if ($r['user_level'] == 5) { $r['username'] = "<a title='Moderator' href='viewuser.php?u={$r['userid']}'><font color=blue>{$r['username']}</font>"; } Quote
skinny Posted December 13, 2008 Author Posted December 13, 2008 Re: HOF-- User level Colours it didnt work :| Quote
BlueDevil23 Posted December 14, 2008 Posted December 14, 2008 Re: HOF-- User level Colours Are you sure user level 5, is Moderator on your game? Quote
skinny Posted December 14, 2008 Author Posted December 14, 2008 Re: HOF-- User level Colours Are you sure user level 5, is Moderator on your game? Yes if($r['user_level'] == 1) { $userl="Mobster"; } else if($r['user_level'] == 2) { $userl="Owner"; } else if ($r['user_level'] == 3) { $userl="Admin"; } else if($r['user_level'] == 0) { $userl="NPC"; } else if($r['user_level'] == 5) { $userl="Moderator"; } else {$userl="Faker"; } Quote
skinny Posted December 14, 2008 Author Posted December 14, 2008 Re: HOF-- User level Colours :-( Also is there a way to make it so Level opens up straight away as you click Hall of fame? Quote
AlabamaHit Posted December 14, 2008 Posted December 14, 2008 Re: HOF-- User level Colours make the level the default...... Quote
skinny Posted December 14, 2008 Author Posted December 14, 2008 Re: HOF-- User level Colours make the level the default...... Ok i did that and it works but still back to the first post Quote
skinny Posted December 17, 2008 Author Posted December 17, 2008 Re: HOF-- User level Colours Still need help on this :( Quote
POG1 Posted December 17, 2008 Posted December 17, 2008 Re: HOF-- User level Colours I haven't tested this but it looks like it will work. Add this somewhere, maybe global_func.. function formatName($id) { $id = abs(@intval($id); $result = mysql_query(sprintf("SELECT id,username,donatordays,user_level FROM users WHERE u.userid = '%u'", $id)); $result = mysql_fetch_assoc($result); switch($result[user_level]) { case 1: $staffType="Player"; break; case 2: $staffType="Admin"; break; case 3: $staffType="Assistant"; break; } return '[url="?page=profile&ID='.$result[id].'"]<span class="'.$staffType.'">'.$result[username].'</span>[/url]'; } Then to use it... echo formatName($r[id]); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.