Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Template Modifications

Reply
 
Thread Tools
Custom Username colours Details »»
Custom Username colours
Version: 1.00, by shaunceb shaunceb is offline
Developer Last Online: Apr 2010 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.8.3 Rating:
Released: 08-09-2009 Last Update: 08-09-2009 Installs: 23
Template Edits
Re-useable Code Translations  
No support by the author.

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 Now

File Type: txt custom usernames.txt (2.7 KB, 193 views)

Screenshots

File Type: jpg Untitled.jpg (4.5 KB, 0 views)
File Type: jpg Untitled1.jpg (21.9 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-10-2009, 10:02 AM
Mysterious2207 Mysterious2207 is offline
 
Join Date: Oct 2008
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Pictures please.
This might be useful.
Reply With Quote
  #3  
Old 08-11-2009, 11:27 AM
RileyFreeman RileyFreeman is offline
 
Join Date: Aug 2009
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I got it working, only problem like I said was the fact not all those colours will work. I will have to go through them to see which ones do and which ones don't. Also have to see what's the max amount of colours you can load. If you know please let me know.

Next are you able to add an option for the names to be in bold? In the screen print you will notice all names that have this are in bold.
Reply With Quote
  #4  
Old 08-11-2009, 11:42 AM
shaunceb shaunceb is offline
 
Join Date: May 2009
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RileyFreeman View Post
So I got it working, only problem like I said was the fact not all those colours will work. I will have to go through them to see which ones do and which ones don't. Also have to see what's the max amount of colours you can load. If you know please let me know.


Next are you able to add an option for the names to be in bold? In the screen print you will notice all names that have this are in bold.
I would imagine the max number you can use is infinite and restricted by how many you actually want to use.


To make the names bold, just replace the first $post[musername] with <b>$post[musername]</b>
Reply With Quote
  #5  
Old 08-11-2009, 12:00 PM
RileyFreeman RileyFreeman is offline
 
Join Date: Aug 2009
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome thanks man.

I think whoever does this we should compile a list of what colours work. This I think would be beneficial to everyone. I think we should compile the list and post here
Reply With Quote
  #6  
Old 08-11-2009, 09:08 PM
KeyHunterz's Avatar
KeyHunterz KeyHunterz is offline
 
Join Date: Mar 2008
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice hack, thanks alot !
Reply With Quote
  #7  
Old 08-11-2009, 09:42 PM
RileyFreeman RileyFreeman is offline
 
Join Date: Aug 2009
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One thing I noticed. My regular users are still able to do it, it just wont have any effect unless they purchase the paid subscription for it. Did I do it wrong or it is not setup for it to be hidden from them until they purchase a paid subscription
Reply With Quote
  #8  
Old 08-11-2009, 10:16 PM
topranger's Avatar
topranger topranger is offline
 
Join Date: Sep 2007
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^ you have done this part wrong

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> 
Reply With Quote
  #9  
Old 08-11-2009, 10:29 PM
RileyFreeman RileyFreeman is offline
 
Join Date: Aug 2009
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by topranger View Post
^ you have done this part wrong

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> 


How do I fix it?
Reply With Quote
  #10  
Old 08-12-2009, 07:28 AM
shaunceb shaunceb is offline
 
Join Date: May 2009
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RileyFreeman View Post
How do I fix it?
Find the userfield_wrapper template, delete the contents and paste this in. Replace the # with the profile id of your box and replace * with the usergroup of your paid subscribers.

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


</if> 
My bad for not paying attention. This is what you need.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.15870 seconds
  • Memory Usage 2,353KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (3)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete