Custom Users Font/Color/Style

tfmteam

New Member
Code Hack

1. In your AdminCP, go to Styles & Templates -> Style Manager -> Toolbar Menu Options -> Available Fonts. Select the entire list and copy it.

2. Go to User Profile Fields -> Add New User Profile Field.

3. Select Single-Selection Menu, press Continue.

4. On the Add New User Profile Field screen, use the following settings:
Title: Default Post Font Color
Description: Select a color to use as a default color to apply to all of your message posts. If you use another color when posting a message, that will override these selections.
Options:
Black
Blue
Cyan
DarkGreen
DarkOliveGreen
DarkOrange
DarkOrchid
DarkRed
DarkSlateBlue
DarkSlateGray
DeepSkyBlue
DimGray
Gray
Green
Indigo
LemonChiffon
LightBlue
Lime
Magenta
MediumTurquoise
Navy
Olive
Orange
PaleGreen
PaleTurquoise
Pink
Plum
Purple
Red
RoyalBlue
SandyBrown
SeaGreen
Sienna
Silver
SlateGray
Teal
Wheat
White
Yellow
YellowGreen

Set Default: None <Setting this to "None" allows a blank option to be selected and saved, which has the effect of not setting a choice, so the default font for the forum is used.>
Display Order: <your choice, or leave as default, which may vary>
Field Required: <your choice, I used "No">
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Allow user to input their own value for this option: No
Display Page:
Which page displays this option?: <Your choice, I used "Options: Other" to put in the section where they choose message editor interface>

5. Repeat step 2 and 3.

6. On the Add New User Profile Field screen, use the following settings:
Title: Default Post Font Face
Description: Select a color to use as a default font to apply to all of your message posts. If you use another font face when posting a message, that will override these selections.
Options:
<here paste the list you have copied in step 1>

Set Default: None <Setting this to "None" allows a blank option to be selected and saved, which has the effect of not setting a choice, so the default font for the forum is used.>
Display Order: <your choice, or leave as default, which may vary>
Field Required: <your choice, I used "No">
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Allow user to input their own value for this option: No
Display Page:
Which page displays this option?: <Your choice, I used "Options: Other" to put in the section where they choose message editor interface>

7. Repeat step 2.

8. Select Multiple-Selection Checkbox, press Continue.

9. On the Add New User Profile Field screen, use the following settings:
Title: Default Post Font Style
Description: Select a style to use as a default font to apply to all of your message posts. If you use another font style when posting a message, that will override these selections.
Options:
Bold
Italic
Underline
Set Default: None <Setting this to "None" allows a blank option to be selected and saved, which has the effect of not setting a choice, so the default font for the forum is used.>
Display Order: <your choice, or leave as default, which may vary>
Field Required: <your choice, I used "No">
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Allow user to input their own value for this option: No
Display Page:
Which page displays this option?: <Your choice, I used "Options: Other" to put in the section where they choose message editor interface>

10. You are redirected to the User Profile Field Manager. Locate the fields you just created and note the Name; it should be "fieldX", where X is a number. Remember those numbers for future reference.

11. Go to Styles & Templates -> Style Manager -> Edit Templates. Select and open the "postbit" template. (Note: If you ONLY use the "postbit_legacy" template, do not bother editing the "postbit" template.)

12. Find:

Code:
<div id="post_message_$post[postid]">$post[message]</div>

13. Replace for:

Code:
<div id="post_message_$post[postid]">
    <if condition="$post[fieldX]"><font face="$post[field6]"></if>
    <if condition="$post[fieldY]"><font color="$post[field5]"></if>
    <if condition="$post['fieldZ'] & 1"><B></if>
    <if condition="$post['fieldZ'] & 2"><I></if>
    <if condition="$post['fieldZ'] & 4"><U></if>    
        $post[message]
    <if condition="$post['fieldZ'] & 4"></U></if>
    <if condition="$post['fieldZ'] & 2"></I></if>
    <if condition="$post['fieldZ'] & 1"></B></if>
    <if condition="$post[fieldY]"></font></if>
    <if condition="$post[fieldX]"></font></if>
</div>

Note:
Replace "X" in FieldX for the Font Face Number (See step 10)
Replace "Y" in FieldX for the Font Color Number (See step 10)
Replace "Z" in FieldX for the Font Style Number (See step 10)

14. Repeat Steps 11, 12 and 13 for the "postbit_legacy" template.

15. Go to User CP --> Configuration and options --> Options and select your font face, color and style.

16. Enjoy
 
Top