Back to vBulletin 3.8 Template Modifications

Custom Username colours
Mod Version: 1.00, by shaunceb

vB Version: 3.8.3 Rating: (2 votes - 3.50 average) Installs: 23
Released: 10 Aug 2009 Last Update: 10 Aug 2009 Downloads: 190
Not Supported Template Edits Re-usable Code Translations  

This is my first posted template edit so be gentle.
It comes courtesy of the username and font hack by gio~logist.

This mod will allow you to define a list of colours for your users to pick from instead of them having to use hex codes. There is also the option of just letting particular user groups use this.

STEP 1

Goto User Profile Fields > Add new user profile field.

Select Single Selection Menu.

Title: Custom Username Colour
Description: Select a custom username colour.

Select your colours from the long list at http://www.w3schools.com/HTML/html_colornames.asp and enter them into the Options box. One colour per line.

Once you're done, save it and make a note of the field number

STEP 2

Edit your Postbit template.
Find

PHP Code:
div id="postmenu_$post[postid]">
                    <if 
condition="$show['profile']">
                    <
class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
                    
$post[onlinestatus]
                    <
script type="text/javascript"vbmenu_register("postmenu_$post[postid]"true); </script>
                    <else />
                    
$post[musername]
                    </if>
                </
div
and replace with
PHP Code:
<div id="postmenu_$post[postid]">
                    <if 
condition="$show['profile']">
                    <
class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">
<if 
condition="$post['fieldx'] != ''  ">
<
font style="color:$post[fieldx]">$post[musername]</font>
<else />
$post[musername]
</if>
</
a>
                    
$post[onlinestatus]
                    <
script type="text/javascript"vbmenu_register("postmenu_$post[postid]"true); </script>
                    <else />


                    
$post[musername]
                    </if>
                </
div
Change the x for your field id.

STEP 3

If you want to display this for certain usergroups;

Go to your Styles & Templates and select the userfield_select_option template.
Replace it with:

PHP Code:
<if condition="THIS_SCRIPT != 'profile' OR (!in_array($profilefield[profilefieldid], array(A, B, C)) OR is_member_of($bbuserinfo, 1, 2, 3))">
<
option value="$key$selected>$val</option>

</if> 
Change the A, B, C to your field id and the 1, 2, 3 to the usergroups you want to allow this for

Select the userfield_wrapper and replace that with the following:

PHP Code:
<if condition="THIS_SCRIPT != 'profile' OR (!in_array($profilefield[profilefieldid], array(A, B, C)) OR is_member_of($bbuserinfo, 1, 2, 3))">
<
fieldset class="fieldset">
    <
legend>$profilefield[title]</legend>
    
$custom_field_holder
</fieldset>


</if> 
Change the A, B, C to your field id and the 1, 2, 3 to the usergroups you want to allow this for

My coding abilities at best can be described as amateur but I'll try to help with any problems.

Download

File Type: %1$s custom usernames.txt (2.7 KB, 195 downloads)

Screenshots

Click image for larger version
Name:	Untitled.jpg
Views:	962
Size:	4.5 KB
ID:	103059   Click image for larger version
Name:	Untitled1.jpg
Views:	1613
Size:	21.9 KB
ID:	103060  


vblts.ru supports vBulletin®, 2022-2024