shrek1609 Posted March 10, 2008 Posted March 10, 2008 Have you any idea how i can set coloured names for staff members... Wrapping user name in font tags works BUT it buggers up the mailbox they can't receive messages with the name wrapped in font tags :( Quote
shaved92bravada Posted March 10, 2008 Posted March 10, 2008 Re: Quick help please where exactly are you wanting the names to be different colors?? I made the color change in viewuser.php, userlist.php, and usersonline.php So if it is one or all of those three I can help ya lol. Quote
shrek1609 Posted March 10, 2008 Author Posted March 10, 2008 Re: Quick help please Thanks for the reply was looking for the colour change to be throughout the game ie mainmenu, viewuser, userlists, halloffame, forums etc Quote
Floydian Posted March 10, 2008 Posted March 10, 2008 Re: Quick help please What error comes up that prevents sending mail like that? And why would the colorized name even be in the mail itself? Quote
shrek1609 Posted March 10, 2008 Author Posted March 10, 2008 Re: Quick help please its not an error code that comes up what happens is when a member tries to send a message to say me the font code over flows the "to" box in the message and errors it Quote
shaved92bravada Posted March 10, 2008 Posted March 10, 2008 Re: Quick help please This is what I use to change the color of my staff usernames if($r['user_level'] > 1 ) { $r['username'] = "<font color=#FF00D4>{$r['username']}</font>} but if you want to make it that way on the mainmenu and stuff like for when a staff member can see their own name then this should work if($ir['user_level'] > 1 ) { $ir['username'] = "<font color=#FF00D4>{$ir['username']}</font>} You can change the color to whatever you want it to be, I use hot pink cause one of my staff didn't think I would. lol Quote
shrek1609 Posted March 10, 2008 Author Posted March 10, 2008 Re: Quick help please thanks for that will give it a try :) Quote
Floydian Posted March 10, 2008 Posted March 10, 2008 Re: Quick help please it sounds like your html code isn't properly formatted. It's most likely missing an apostrophe somewhere. Quote
Haunted Dawg Posted March 10, 2008 Posted March 10, 2008 Re: Quick help please Here add this into ur header: $t = mysql_query("SELECT * FROM users WHERE userid='{$_GET['u']}'") or die(mysql_error()); $c = mysql_fetch_assoc($t); if($c['user_level'] == 2 || $ir['user_level'] == 2) { $r['username'] = "<font color=red>{$r['username']}</font>"; $ir['username'] = "<font color=red>{$ir['username']}</font>"; } if($c['user_level'] == 3 || $ir['user_level'] == 3) { $r['username'] = "<font color=blue>{$r['username']}</font>"; $ir['username'] = "<font color=blue>{$ir['username']}</font>"; } if($c['user_level'] == 5 || $ir['user_level'] == 5) { $r['username'] = "<font color=yellow>{$r['username']}</font>"; $ir['username'] = "<font color=yellow>{$ir['username']}</font>"; } Then the username will appear in the color as u want on the view user and on every page you use ur name will appear in the color i hope unless your other code dont destroy and stuff. Floydian could help you a bit with my code. Quote
shrek1609 Posted March 11, 2008 Author Posted March 11, 2008 Re: Quick help please thanks for that but didn't work i'm afraid only changed my name for me viewing it only :( Quote
Floydian Posted March 11, 2008 Posted March 11, 2008 Re: Quick help please soz killah, there isn't much I can do with that. It looked interesting, but closer inspection showed me number one: you did select * which would be a big waste if all you want is the username... Secondly, that will only affect one username, not all usernames on a page. so, there's no sense in adding that to the header if it can't add color to all usernames. Personally, I take userid's in the database, and run them through a function I call: profile() that function is used everywhere there is a clickable username, and it can make usernames colorcoded :-) if you want it too. but, ya gotta add the function in everywhere you want to use it. This is not mc code compatible code, but it demonstrates the idea of what my profile code does. Adding in user_level to the query, and then colorizing the names accordingly from there would be a snap, and it's something I may do at some point. It'd take all of 3 minutes to colorize every name on my site ;) // Link to user profile function profile($id) { $q = sprintf('select username, user_id from users where user_id = %d limit 1', (int) $id); $query = query($q); if (mysql_num_rows($query) < 1) { $username = "User does not exist"; } else { list($name, $id) = fa($query); $profile = <<<EOT [url="index.php?p=view&case=view&user_id=$id"]$name[/url] [$id] EOT; } return $profile; } Quote
Haunted Dawg Posted March 11, 2008 Posted March 11, 2008 Re: Quick help please I converted this to mccode based: // Link to user profile function profile($id) { $q = sprintf('select username, userid from users where userid = %d limit 1', (int) $id); $query = query($q); if (mysql_num_rows($query) < 1) { $username = "User does not exist"; } else { list($name, $id) = fa($query); $profile = <<<EOT $name [$id] EOT; } return $profile; } And floydian my code would work only for viewusers.php and every other page the actual user looks at because of the $ir and the $r since basicly thats the most common used var's in mccodes :lol: Quote
shrek1609 Posted March 11, 2008 Author Posted March 11, 2008 Re: Quick help please The last two posts have gone totally over my head :( I dont suppose you could simplify what i need to do for an idiot could you :) thanks Quote
shaved92bravada Posted March 11, 2008 Posted March 11, 2008 Re: Quick help please in my personal opinion the only pages you really need to color code the names would be usersonline, userlist, and viewuser. Because if someone is staff they would know and wouldn't really need their name to be colored on the main page. So like I said if it is on either of those 3 then I can help ya with it, if it is any of the others then there isn't much I could do lol. Quote
Floydian Posted March 11, 2008 Posted March 11, 2008 Re: Quick help please killah, you are simply wrong about how your code would work. first and foremost, the $r variable WOULD NOT be set before the header executes so it's pointless, and I know you could not have tested the code out, and if you did, you would see that it would not work that way. aye caramba.... Quote
Guest Anonymous Posted March 17, 2008 Posted March 17, 2008 Re: Quick help please Well as a hint... I use a function called name_format... which basically performs various tricks... function name_format( $user ) { $donator_image = ""; if ($user['is_a_staff_member']) { $link_color = "red"; } else if ($user['is_a_donator']) { $link_color = "green"; $donator_image = "[img=donator.png]"; } else { $link_color = "blue"; } return sprinf ( "[url='view-user-profile.php?user-id=%u']%s%s[%u][/url]", $user['id-number'], $link_color, $user['name'], $donator_image, $user['id-number'] ); } Then everytime I want to display a users name (nicely colored and with a little donator image) I just call: echo name_format($user); Simple! Quote
Haunted Dawg Posted March 17, 2008 Posted March 17, 2008 Re: Quick help please Yes floydian but it was a suggestion since the header will run using the $h->startheaders(); and i thought if the $r global is in the start headers function it would carry on. I have not tested it but i know it should not work. Quote
Floydian Posted March 17, 2008 Posted March 17, 2008 Re: Quick help please Nice function Nyna ;) killah, I see what you mean, but unfortunately it isn't going to work that way. Consider Nyna's function, it tests to see if a name is a staff members name (in generic terms of course) or a regular player, and if they are a regular player it checks to see if they are a donor. In order to do that, you have to have a name (or userid or some other data linked to the user such as donor_days). When $h->startheaders() is called, you won't have any of that data. Well, I'm not sure if I can explain it 100% perfect, but hopefully that gets the point across. 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.