Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Allow users to change user title color Details »»
Allow users to change user title color
Version: 2.0, by Brundun Brundun is offline
Developer Last Online: Jan 2015 Show Printable Version Email this Page

Category: Profile Enhancements - Version: 4.2.1 Rating:
Released: 03-05-2014 Last Update: Never Installs: 4
Template Edits
Re-useable Code  
No support by the author.

Hi all, this is my first release, I'm not sure if this has been released before but I thought of this the other day and implemented it onto a forum of mine.

About:
This template modification allows users of your forum community to change the color and font weight of their user title by entering a color HEX code in the Edit Profile in UserCP.

How to do this:

First Step:
What you're going to do is go to your AdminCP and find 'User Profile Fields' and select 'Add New Profile Field'.

You're going to need to create two separate fields:
Code:
First one needs to be - Single-Line Text Box with a title of Custom User title color or what ever you want it to be

Second one needs to be - Single-Selection Radio Buttons with a title of Bold or Normal or what ever u want it, for options on this one you need it to be bold and normal like this: http://i.imgur.com/KxGb26X.png
Second Step:

Go to Styles & Templates > Style Manager > {Your Theme Name} > Edit Templates > Posbit > Postbit_Legacy

Search for:
Code:
<span class="usertitle">   {vb:raw post.usertitle}  </span>
and replace it with
Code:
<span class="usertitle">

			<span style="color:<vb:if condition="$post['fieldX']">{vb:raw post.fieldX}</vb:if>; font-weight:<vb:if condition="$post['fieldX]">{vb:raw post.fieldX}</vb:if>;">{vb:raw post.usertitle}</span>
			
</span>
Replace the Red X in my code with the field number in your admincp for the Custom User Title Color field.

Replace the Green X in my code with the field number in your admincp for the Bold and Normal field.

users should be able to edit the color of their user title and font-weight in UserCP > Edit Profile and scroll to the bottom. Version 2:
Added 3 more styling options, Glow, Marquee Scroll and Ability to add sparkle image(note: doesnt look good with a scroll)

You need to add 5 user profile fields.

First one needs to be - Single-Line Text Box with a title of Custom User title color or what ever you want it to be

Second one needs to be - Single-Selection Radio Buttons with a title of Bold or Normal or what ever u want it, for options on this one you need it to be bold and normal like dis

Third one needs to be Single-Line Text Box with the title of Sparkle Image or what ever you want lol

Fourth one needs to be Single-Line Text Box with the title of Glow.

Fifth needs to be a Single-Selection Menu with the title or Marquee or Scroll w.e, when setting this one up where it says Set Default, have it to None



Go to Styles & Templates > Style Manager > { your theme name} > Edit Templates > Posbit > Postbit_Legacy

Search for:
Code:
<span class="usertitle">
{vb:raw post.usertitle}
</span>
replace it with:
Code:

<span class="usertitle">

			<span style="color:<vb:if condition="$post['fieldX']">{vb:raw post.fieldX}</vb:if>; font-weight:<vb:if condition="$post['fieldX]">{vb:raw post.fieldX}</vb:if>; background: url(<vb:if condition="$post['fieldX']">{vb:raw post.fieldX}</vb:if>)">; <vb:if condition="$post['fieldX']"> text-shadow: 0 0 1em {vb:raw post.fieldX}";</vb:if>"><vb:if condition="$post['fieldX']"><marquee behavior="scroll" direction="{vb:raw post.fieldX}"></vb:if>{vb:raw post.usertitle}</span></marquee>
</span>
Red X - User Title Color Field Number
Green X - Bold or Normal Field Number
Blue X - Sparkle Image Field Number
Orange X - Glow Field Number
Purple X - Marquee Scroll Field Number


Thanks for reading and I hope this is useful to some people and I'm sorry if this is done before.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
SPEEDKILLZ

Comments
  #2  
Old 03-06-2014, 12:29 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First of all thanks for sharing, it is what makes this place work!

Note - This is not a criticism, just a bit of awareness to those that might use the code.

In order for this to be minimally safe the field entries in the ACP should have a regular expression set for the user input and a field length. Otherwise I could simple add my own CSS to the template, or possibly something worse. Additional validity testing can also be added by using plugin/hook.

Again thanks for sharing.
Reply With Quote
Благодарность от:
SPEEDKILLZ
Reply


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 09:56 AM.


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.04856 seconds
  • Memory Usage 2,230KB
  • Queries Executed 16 (?)
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
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete