vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=236)
-   -   Forum Display Enhancements - Custom Username colours (https://vborg.vbsupport.ru/showthread.php?t=220564)

shaunceb 08-09-2009 10:00 PM

Custom Username colours
 
1 Attachment(s)
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.

Mysterious2207 08-10-2009 10:02 AM

Pictures please.
This might be useful.

RileyFreeman 08-11-2009 11:27 AM

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.

shaunceb 08-11-2009 11:42 AM

Quote:

Originally Posted by RileyFreeman (Post 1865058)
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>

RileyFreeman 08-11-2009 12:00 PM

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

KeyHunterz 08-11-2009 09:08 PM

nice hack, thanks alot !

RileyFreeman 08-11-2009 09:42 PM

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

topranger 08-11-2009 10:16 PM

^ 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> 


RileyFreeman 08-11-2009 10:29 PM

Quote:

Originally Posted by topranger (Post 1865445)
^ 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?

shaunceb 08-12-2009 07:28 AM

Quote:

Originally Posted by RileyFreeman (Post 1865452)
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.

RileyFreeman 08-12-2009 01:36 PM

Quote:

Originally Posted by shaunceb (Post 1865670)
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, *))">
<
option value="$key$selected>$val</option>

</if> 




The following error occurred when attempting to evaluate this template:

Parse error: syntax error, unexpected '*' in ********************************************'d code on line 1

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.



i blocked out the stuff with stars cuz i dont know if its private or not

RileyFreeman 08-13-2009 12:35 AM

okay well i entered it and didnt get the error but its still showing it for non paying users.

below is what i entered. paid members are 9


PHP Code:

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


</if> 


DynaMow 09-07-2009 01:28 PM

In his instructions it says enter your color choices in the options box.

I do not see no stinkin options box!!!!!!!!!

Everytime I try to add a hack of any kind there is always a problem for me

and its always me, nevermind I figured out what I was doing wrong

New Joe 09-07-2009 02:12 PM

It didn't work, the colors of a user name don't change.
Do you have to do STEP 3 as I didn't?

New Joe 09-07-2009 02:52 PM

I did follow and edit as it says and put in the right field id. I do use Version 3.8.2 but I don't see why that should matter.
Does anyone have this working if so any problems like myself?

MrSir 09-12-2009 03:24 PM

I just installed it and its working just fine so far.

Arcade Fire 09-28-2009 09:30 AM

Nice, but not show in forumhome, any idea?

New Joe 10-15-2009 07:31 AM

I followed step 1 and 2 but it doesn't work.
I though this mod was supported?

New Joe 10-15-2009 08:20 AM

My bad, I forgot to edit the postbit_legacy template.
Works good now.

But it doesn't show the user name colors when you hit the 'New Posts'
Which template needs to be edited for this?

TheLastSuperman 10-15-2009 11:56 AM

Quote:

Originally Posted by Arcade Fire (Post 1891694)
Nice, but not show in forumhome, any idea?

Try adding
Code:

THIS_SCRIPT != 'index'
to the code example:
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 to (And remember to change the A/B/C and 1/2/3 to what you need them to be but new example:

Code:

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

</if>

Let me know seems like it should be a quick fix but I did not install and do not need to so let me know as I said :p

baghdad4ever 10-16-2009 09:16 AM

thanks

how to make the color choose from dropdown menu like this

https://vborg.vbsupport.ru/external/2010/08/13.jpg

MagicThemeParks 08-22-2010 12:25 PM

Quote:

Originally Posted by baghdad4ever (Post 1900787)
thanks

how to make the color choose from dropdown menu like this

https://vborg.vbsupport.ru/attachmen...0&d=1249903039

Step 1 in the instructions is this.

Brandon Sheley 08-22-2010 03:29 PM

nice mod, one of my users was asking for something similar, will check this out today
would this work on 4.x as well?

thx

DIBBLE 10-10-2010 09:08 AM

yes it would work on vB4

BirdOPrey5 10-11-2010 02:24 PM

THIS WILL NOT WORK on VB4 as is... the template code would need to be updated,

BirdOPrey5 10-11-2010 03:50 PM

The "font" tag is being depreciated from HTML, you can get the same results by using "SPAN" instead.

Change:
Code:

<font style="color:$post[fieldx]">$post[musername]</font>
to:
Code:

<span style="color:$post[fieldx]">$post[musername]</span>
But my issue is when I do this the color of the link no longer changes when the house hovers over it- is there any way to allow it to keep changing color when you mouse-over?

DIBBLE 10-20-2010 04:49 PM

how do i get it to work on the homepage and in shoutbox?

Brandon Sheley 12-07-2010 06:51 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2109094)
The "font" tag is being depreciated from HTML, you can get the same results by using "SPAN" instead.

Change:
Code:

<font style="color:$post[fieldx]">$post[musername]</font>
to:
Code:

<span style="color:$post[fieldx]">$post[musername]</span>
But my issue is when I do this the color of the link no longer changes when the house hovers over it- is there any way to allow it to keep changing color when you mouse-over?

thanks, I'll try it out and bump this thread
it would be great to get a plugin for this with zero template edits :up:

DarkGizmo 03-02-2011 05:08 AM

Hey man, I installed your mod and did some tiny modifications to it, however, I was wondering if it's possible to get this to appear in the active users bit? It seems that the variable $activeusers needs to be edited, but i'm not sure how that can be done? Any help on getting this working in the active users bit would be fantastic!

Also if you can post instructions on how to get it in:
-Memberlist
-Forumhome/viewing a forum
-Showgroups

Thanks!

Robbie P 11-13-2012 03:44 PM

This isn't working on vBulletin 3.8.7 PL3 - could someone provide me with a fix?


All times are GMT. The time now is 03:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01219 seconds
  • Memory Usage 1,848KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (9)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (30)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete