[Suggestion] Customizable Username Colors

X Prime 07-18-2004 11:58 PM
quote:
Originally posted by Seraphim
quote:
Originally posted by X Prime
Axehandle's solution borders on an ugly hack instead of something that would be seamlessly integrated into the WBB... So, yes, it is elementary... Not to mention decidedly inefficent.


It's so small, though, I think it could be worked in pretty seamlessly.


See my edit, I gave it a bit more thought. Still won't quite work that easily, Krang would still have to edit the WIO parsing.
Jonny Axehandle 07-18-2004 11:59 PM
quote:
Originally posted by X Prime
Axehandle's solution borders on an ugly hack instead of something that would be seamlessly integrated into the WBB... So, yes, it is elementary... Not to mention decidedly inefficent.

I do not have a WBB so I can't make something seemless. Besides, we are talking about custom colors for a username. How complex does it have to be? And yes, I know what I am talking about. I have modded IPB quite a few times.

quote:
Originally posted by Krang
quote:
Originally posted by Jonny Axehandle
if( $user_data['custom_color'] != '' ){
$color = $user_data['custom_color'];
} else {
$color = $default;
};

<span style='color:{$color}'>Username</span>

Elemetary my Dr. Krang. And if BB works anything like IPB, you don't need to add any queries.

Thanks for the help, but unfortunately, I don't think it would be that easy due to the way that WBB is coded (and extra checks would have to be done for security reasons). I'll look at the code just in case, though.


Can you post the code that gets the user data for topic view?
Seraphim 07-19-2004 12:00 AM
It's a simple solution for a simple objective. When you break it down logically, all you need is:

1) A field in the profile edit screen to input or select a color from a drop-down box (maybe every color you can type with)
2) A place to store the variables - user profile.
3) The code to interpret it when someone views the username.

Axehandle's fix might work well.
X Prime 07-19-2004 12:02 AM
quote:
Originally posted by The Fallen Phoenix
quote:
Originally posted by X Prime
Axehandle's solution borders on an ugly hack instead of something that would be seamlessly integrated into the WBB... So, yes, it is elementary... Not to mention decidedly inefficent.


Out of curiosity, how would you do it, then? I'm sure if someone could come up with a way, Krang would program it in...


If you must have an example... Here are my edited functions located in class_useronline... I think it's legal to post this, considering WBBMods...

code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function parse($userid,$username,$useronlinemarking,$wioeffect,$invisible) {
  global $tpl, $session, $lang;
  
  if(in_array($userid,$this->buddies)) eval ("\$username = \"".$tpl->get("useronline_buddy")."\";");
    
  if(!$wioeffect) {
  if($useronlinemarking!="") $username=sprintf($useronlinemarking,$username); } else { $username=sprintf($wioeffect,$username); }
  
  eval ("\$useronlinebit = \"".$tpl->get("index_useronline")."\";");
  return $useronlinebit;
 }

function user($userid,$username,$useronlinemarking,$wioeffect,$invisible) {
  if($invisible==1 && $this->can_view_ghosts==0) return "";
  if($this->useronlinebit!="") $this->useronlinebit .= ", ".$this->parse($userid,$username,$useronlinemarking,$wioeffect,$invisible);
  else $this->useronlinebit = $this->parse($userid,$username,$useronlinemarking,$wioeffect,$invisible);
 }
}


The only problem is that, essentially, you would need to replace every call of those functions located in variious files to account for the new variable, not to mention edit SQL queries to actually fetch the values.

Though, to be a tad more honest, I didn't bother coding in group allowance considerations, but I've done group editing before, and let me tell you... It is long, tedious, AND ANNOYING AS ALL HELL. Though, supposedly, the German subscribers can get a tool to do it automatically... Go fig.

Plus, it's a bit more encompassing, and thusly not as secure as a simple color replace, since it allows total WIO control, though not to forum breaking levels (It ain't long enough to set a meta tag now, after I noted that vulnerability). Though, let's face it, somebody is always gonna punch holes if you allow them any sort of opening for HTML screwage... Without proper stripping/editing functions to run them through anyway. Thank the stars for wbb_trim when applicable...

Honestly, I think integrating it into the WIO is the best idea. I mean, it practically begs to be extended with this kind of functionality, and it could be made rock solid...
Krang 07-19-2004 01:43 AM
Thanks for the suggestions, X Prime. I'll take a look at the WIO code and see if there's a way to implement this without modifying too many files.
X Prime 07-19-2004 01:48 AM
AFAIK, you'll need to modify index, wiw, board, and thread.php at the very least, besides class_useronline... Then of course usercp and usercp templates to actually make the option visible and settable. And unless you don't mind going into the DB every time if it's abused, you'll need to edit acp users.php, and it's templates...

Now, if you want it group specific, prepare to spend hours on it... No way around it sadly, unless there's a usable automatic tool.

EDIT: Or you're willing to do a fairly dirty hack in usercp with groupids... *Shrug*