lRhyss
28-05-2011, 08:58 PM
Ok, I like the new rainbow donator, so I'm going to release a tutorial on how to get it on your forum!
Note: this only works on vBulletin forums and to use set this up you must have Usergroup and Plugin Access on the Admin Panel.
First: Create a usergroup on the Admin Panel. You can set the Usergroup to have any perms they want. This will not effect the effect in any way.
When you have created the usergroup, use this HTML Markup for the username (FIRST BOX);
<strong style="color: #FFBC58; rainbow: true;">
And in the second box;
</strong>
What this does is just creates some normal HTML markup which will make the username this colour (you can change the colour if you wish) before the plugin is installed, and adds in a dummy rainbow: true;.
That was the easy part. The next part is slightly more complicated, but not much. So pay attention;
Plugin
Add a new plugin in vBulletin, with the following information;
Product: vBulletin
Hook Location: fetch_musername
Title: Rainbow
Execution Order: 1
Active: Yes
Code
Use this for the Plugin Code;
if( strpos( $user['musername'], 'rainbow: true;' ) !== false )
{
This checks if the musername (markup username) of the user contains the dummy rainbow: true; that we set earlier (this means you can apply it to more than one group if you want to) and if it does, we will create the username.
$i = $b = 0;
$username = '';
$colours = array('d31539', 'ff7e00', 'ffc20e', '90d125', '187acb', '6f3198', 'ab1d8e');
This sets up three pieces of code - the variables $i and $b run with the username, with $i being the current character the script is working on and $b being the colour number the character is being set to. The $username string is just an empty string that the username will be constructed into and the $colours array is an array of hex codes for the rainbow username. You can add/remove colours and it will still loop through them all!
while( $i < strlen( $user['username'] ) )
{
if( $b > ( count( $colours ) - 1 ) ) $b = 0;
$username .= '<span style="color: #' . $colours[ $b ] . '">' . $user['username'][$i] . '</span>';
++$b;
++$i;
}
This ends off the code, setting the musername to our generated username, and making it bold at the same time.
The full code:
if( strpos( $user['musername'], 'rainbow: true;' ) !== false )
{
$i = $b = 0;
$username = '';
$colours = array('d31539', 'ff7e00', 'ffc20e', '90d125', '187acb', '6f3198', 'ab1d8e');
while( $i < strlen( $user['username'] ) )
{
if( $b > ( count( $colours ) - 1 ) ) $b = 0;
$username .= '<span style="color: #' . $colours[ $b ] . '">' . $user['username'][$i] . '</span>';
++$b;
++$i;
}
$user['musername'] = '<strong>' . $username . '</strong>';
Enjoy!
BTW I take no credit for this, it was on a forum I found and I basically just rewrote it so it's 'Noob Friendly'
Note: this only works on vBulletin forums and to use set this up you must have Usergroup and Plugin Access on the Admin Panel.
First: Create a usergroup on the Admin Panel. You can set the Usergroup to have any perms they want. This will not effect the effect in any way.
When you have created the usergroup, use this HTML Markup for the username (FIRST BOX);
<strong style="color: #FFBC58; rainbow: true;">
And in the second box;
</strong>
What this does is just creates some normal HTML markup which will make the username this colour (you can change the colour if you wish) before the plugin is installed, and adds in a dummy rainbow: true;.
That was the easy part. The next part is slightly more complicated, but not much. So pay attention;
Plugin
Add a new plugin in vBulletin, with the following information;
Product: vBulletin
Hook Location: fetch_musername
Title: Rainbow
Execution Order: 1
Active: Yes
Code
Use this for the Plugin Code;
if( strpos( $user['musername'], 'rainbow: true;' ) !== false )
{
This checks if the musername (markup username) of the user contains the dummy rainbow: true; that we set earlier (this means you can apply it to more than one group if you want to) and if it does, we will create the username.
$i = $b = 0;
$username = '';
$colours = array('d31539', 'ff7e00', 'ffc20e', '90d125', '187acb', '6f3198', 'ab1d8e');
This sets up three pieces of code - the variables $i and $b run with the username, with $i being the current character the script is working on and $b being the colour number the character is being set to. The $username string is just an empty string that the username will be constructed into and the $colours array is an array of hex codes for the rainbow username. You can add/remove colours and it will still loop through them all!
while( $i < strlen( $user['username'] ) )
{
if( $b > ( count( $colours ) - 1 ) ) $b = 0;
$username .= '<span style="color: #' . $colours[ $b ] . '">' . $user['username'][$i] . '</span>';
++$b;
++$i;
}
This ends off the code, setting the musername to our generated username, and making it bold at the same time.
The full code:
if( strpos( $user['musername'], 'rainbow: true;' ) !== false )
{
$i = $b = 0;
$username = '';
$colours = array('d31539', 'ff7e00', 'ffc20e', '90d125', '187acb', '6f3198', 'ab1d8e');
while( $i < strlen( $user['username'] ) )
{
if( $b > ( count( $colours ) - 1 ) ) $b = 0;
$username .= '<span style="color: #' . $colours[ $b ] . '">' . $user['username'][$i] . '</span>';
++$b;
++$i;
}
$user['musername'] = '<strong>' . $username . '</strong>';
Enjoy!
BTW I take no credit for this, it was on a forum I found and I basically just rewrote it so it's 'Noob Friendly'