Log in

View Full Version : multicolored name


MathewC
10-14-2007, 11:28 AM
<a href="http://www.mmoccforum.com/interviews-articles/6994-interview-amber-hydro-island-community-manager.html#post67122" target="_blank">http://www.mmoccforum.com/interviews...html#post67122</a>

How did he get two colors as his name? :P

dyna88
10-14-2007, 12:12 PM
He used the font tag...

<font color="black">C</font><font color="orange">h</font><font color="black">u</font>

johnrizz
10-14-2007, 04:32 PM
Where is this tag placed?

Kirk Y
10-14-2007, 05:44 PM
No.. that wouldn't work. You'd need a plugin to break down the username and switch the style on each letter.

RobDog888
10-14-2007, 10:48 PM
You would also want to use the "<span style='color: #FF0000;'/>" as its more w3c compliant. :)

Chris M
10-14-2007, 11:57 PM
You can also use vBulletin's own Replacements system to replace all occurences of "Chris M" to "Chris M" etc

Chris

Freesteyelz
10-15-2007, 12:13 AM
You would also want to use the "<span style='color: #FF0000;'/>" as its more w3c compliant. :)

It should be:


<span style="color:#ff0000">text_here</span>


I also tend to like to keep everything lower case. :)

Kirk Y
10-15-2007, 12:46 AM
Well I got bored and decided to see what I could put together, and came up with this:
$x = 0;
while($x < strlen($this->post['username']) AND $this->post['usergroupid'] == 6)
{
$_color = ($_color == "red") ? "black" : "red";
$post['musername'] .= "<span style='color:".$_color."'>".$this->post['username'][$x]."</span>";
$x++;
}


Dunno how efficient it is, but it does work.

johnrizz
10-15-2007, 01:05 AM
Well I got bored and decided to see what I could put together, and came up with this:
$x = 0;
while($x < strlen($this->post['username']) AND $this->post['usergroupid'] == 6)
{
$_color = ($_color == "red") ? "black" : "red";
$post['musername'] .= "<span style='color:".$_color."'>".$this->post['username'][$x]."</span>";
$x++;
}


Dunno how efficient it is, but it does work.

Could you please explain on were to place this? is this a plugin?

Freesteyelz
10-15-2007, 01:10 AM
<span style='color:".$_color."'>



Is that syntax correct?

Kirk Y
10-15-2007, 01:15 AM
Could you please explain on were to place this? is this a plugin?

Sorry, thought I did. Add a new plugin using hook location "postbit_display_start" with the code I posted.

Is that syntax correct?

Yes...

Freesteyelz
10-15-2007, 01:38 AM
Ahh, ok. I wondered because generally there are double quotes surrounding the attributes/values rather than single quotes.

Kirk Y
10-15-2007, 01:39 AM
They're interchangeable, I just didn't feel like escaping the double quotes.

Freesteyelz
10-15-2007, 01:41 AM
Cool. :)

RobDog888
10-15-2007, 01:41 AM
It should be:


<span style="color:#ff0000">text_here</span>


I also tend to like to keep everything lower case. :)
Just an example as I didnt write it to be functional. ;)

johnrizz
10-15-2007, 02:19 AM
thanks Kirk Y, that worked... you made that look ez...

LegionStar
04-13-2009, 07:03 PM
how do i configure it with the usernames Kirk Y

johnrizz
04-13-2009, 08:16 PM
This is how I did it....

Add New Plugin

1: In Product >> vbulletin
2: Hook Location >> postbit_display_start
2: Title >> multicolored name
3: Execution Order >> 5
4: Plugin PHP Code >> $x = 0;
while($x < strlen($this->post['username']) AND $this->post['usergroupid'] == 6)
{
$_color = ($_color == "gray") ? "black" : "gray"; "black";
$post['musername'] .= "<span style='color:".$_color."'>".$this->post['username'][$x]."</span>";
$x++;
}
just change the colors to your liking!

For usergroupid'] == 6) everyone in this user group will be the same color....

Rap-royalty.com
05-21-2010, 07:58 PM
This is awesome... Is there a way to make it show throughout the forum instead of just posts?