vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Profile Enhancements - Allow users to change user title color (https://vborg.vbsupport.ru/showthread.php?t=309222)

Brundun 03-05-2014 11:00 PM

Allow users to change user title color
 
1 Attachment(s)
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.

tbworld 03-06-2014 12:29 PM

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.


All times are GMT. The time now is 09:13 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.00990 seconds
  • Memory Usage 1,727KB
  • 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
  • (6)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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