vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Default Font/Size/Color in a Post. (https://vborg.vbsupport.ru/showthread.php?t=93395)

applehat 07-31-2005 10:00 PM

Default Font/Size/Color in a Post.
 
Default Font/Color/Size in a Post
This hack will allow your users to set there default font that will appear in there posts from the User CP.


Yes, I know this can be done with custome user feilds, but I dont like those because they change on every persons site...this just makes more sence.
(Remember that this is a Product! Use the product manager!)

This releace does not have the plugin required to get the defaults for a user back out of the database so that users dont have to reset there defaults every time they visit the options page. If you want to write this part, be my guest. (Because I realy dont know how.)



Details
1 Product XML
2 Template Edits

History
1.0.1 Fixed some stuff and redesigned 1 template edit.
1.0.0 Initial Version
Note: Tested on RC1 only!


Template Edits:

1) Open Modify User Option Templates -> modifyoptions

FIND:
PHP Code:

<thead>
    <
tr>
        <
td class="thead">
            <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('uopt_thrd')"><img id="collapseimg_uopt_thrd" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_uopt_thrd].gif" alt="" border="0" /></a>
            
$vbphrase[thread_display_options]
        </
td>
    </
tr>
</
thead>
<
tbody id="collapseobj_uopt_thrd" style="$vbcollapse[collapseobj_uopt_thrd]">
    <
tr>
        <
td class="panelsurround" align="center">
        <
div class="panel">
            <
div style="width:$stylevar[formwidth_usercp]align="$stylevar[left]"

ADD BELOW:
PHP Code:

            <!--APPLE DEFAULT FONT HACK-->
        <
fieldset class="fieldset">
                <
legend><label for="deffont">$vbphrase[default_font_TITLE]</label></legend>
                <
table cellpadding="0" cellspacing="$stylevar[formspacer]border="0" width="100%">
                <
tr>
                    <
td>$vbphrase[default_font_DESC]</td>
                </
tr>
                <
tr>
                    <
td>
                     
                        <
select name="deffont" id="sel_deffont">
                            <
option value="Arial">Arial</option>
                            <
option value="Verdana">Verdana</option>
                            <
option value="Lucida Console">Lucida Console</option>
                            <
option value="Century Gothic">Century Gothic</option>
                            <
option value="Times New Roman">Times New Roman</option>
                
                        </
select>
            <
select name="defsize" id="sel_defsize">
                            <
option value="1">1</option>
                            <
option value="2">2</option>
                            <
option value="3">3</option>
                            <
option value="4">4</option>
                            <
option value="5">5</option>
                            <
option value="6">6</option>
                            <
option value="7">7</option>
                        </
select>
            <
select name="defcolor" id="sel_defcolor">
                            <
option value="Black">Black</option>
                            <
option value="Blue">Blue</option>
                            <
option value="Red">Red</option>
                            <
option value="Green">Green</option>
                            <
option value="Orange">Orange</option>
                            <
option value="Yellow">Yellow</option>
                            <
option value="Pink">Pink</option>
                        </
select>
               </
td>
                </
tr>
                </
table>
            </
fieldset>  
        <!--/
APPLE DEFAULT FONT HAT--> 


2) Open Postbit Templates -> postbit (or postbit_legacy)

FIND:
PHP Code:

$post[message

There may be DIV tags around it, leave those alone!

REPLACE WITH:
PHP Code:

    <if condition="$post[deffont] || $post[defsize] || $post[defcolor]">
    <
font face="$post[deffont]size="$post[defsize]color="$post[defcolor]">$post[message]</font>
    <else />
    
$post[message]
    </if> 



If you know any better way of doing what I am doing (like possibly pulling the font, size, and color options from the same place the editor pulls them) please tell me. I admit to being a n00b :)

applehat 08-01-2005 09:10 PM

Just noticed I didn't include many colors or fonts...will fix.

MrSDavidson 08-01-2005 09:49 PM

Edit, NM just realised

Wordplay 08-13-2005 02:05 PM

is this the same as the personal font color in posts hack?

bgtking 08-13-2005 04:18 PM

Hmm, this doesn't have permissions does it?

Brinnie 08-13-2005 07:44 PM

Quote:

Originally Posted by bgtking
Hmm, this doesn't have permissions does it?

Just remove the size selector from the style template. :)

FD929 08-13-2005 11:02 PM

Quote:

Originally Posted by Brinnie
Just remove the size selector from the style template. :)

Yep. Had to. Good work Apple. :)

applehat 08-16-2005 10:03 PM

Thanks. I dont even use this hack anymore. I went back to using Custome User Fields and just relocated the "others" hook into a "Color Options" table. Works fine for me :-P

Wayne Luke 08-17-2005 03:34 AM

Can you post the one where you use custom fields or is it just a template edit?

applehat 08-18-2005 04:00 AM

Its 2 template changes. One to the postbit and one to the user options template...forget its name.

FD929 08-18-2005 02:38 PM

Here is the code for the full list of default fonts.

This code is minus the size option.

Changed:
<!--/APPLE DEFAULT FONT HAT-->
To:
<!--/APPLE DEFAULT FONT HACK-->
since I saw no reason why a hack should wear a hat. :ermm:

1) Open Modify User Option Templates -> modifyoptions

FIND:
Code:

<thead>
    <tr>
        <td class="thead">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('uopt_thrd')"><img id="collapseimg_uopt_thrd" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_uopt_thrd].gif" alt="" border="0" /></a>
            $vbphrase[thread_display_options]
        </td>
    </tr>
</thead>
<tbody id="collapseobj_uopt_thrd" style="$vbcollapse[collapseobj_uopt_thrd]">
    <tr>
        <td class="panelsurround" align="center">
        <div class="panel">
            <div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">

Add below:
Code:

<!--APPLE DEFAULT FONT HACK-->
        <fieldset class="fieldset">
                <legend><label for="deffont">$vbphrase[default_font_TITLE]</label></legend>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
                <tr>
                    <td>$vbphrase[default_font_DESC]</td>
                </tr>
                <tr>
                    <td>
                        <select name="deffont" id="sel_deffont">
                            <option value="Arial">Arial</option>
                            <option value="Verdana">Verdana</option>
                            <option value="Lucida Console">Lucida Console</option>
                            <option value="Century Gothic">Century Gothic</option>
                            <option value="Times New Roman">Times New Roman</option>
                            <option value="Arial Black">Arial Black</option>
                            <option value="Arial Narrow">Arial Narrow</option>
                            <option value="Book Antiqua">Book Antiqua</option>
                            <option value="Century Gothic">Century Gothic</option>
                            <option value="Comic Sans MS">Comic Sans MS</option>
                            <option value="Courier New">Courier New</option>
                            <option value="Fixedsys">Fixedsys</option>
                            <option value="Franklin Gothic Medium">Franklin Gothic Medium</option>
                            <option value="Garamond">Garamond</option>
                            <option value="Georgia">Georgia</option>
                            <option value="Impact">Impact</option>
                            <option value="Lucida Sans Unicode">Lucida Sans Unicode</option>
                            <option value="Microsoft Sans Serif">Microsoft Sans Serif</option>
                            <option value="Palatino Linotype">Palatino Linotype</option>
                            <option value="System">System</option>
                            <option value="Tahoma">Tahoma</option>
                            <option value="Trebuchet MS">Trebuchet MS</option>       
                      </select>
            <select name="defsize" id="sel_defsize">
                            <option value="2">2</option>
                        </select>
            <select name="defcolor" id="sel_defcolor">
                            <option value="Black">Black</option>
                            <option value="Blue">Blue</option>
                            <option value="Red">Red</option>
                            <option value="Green">Green</option>
                            <option value="Navy">Navy</option>
                            <option value="Orange">Orange</option>
                            <option value="Yellow">Yellow</option>
                            <option value="Pink">Pink</option> 
                        </select>
              </td>
                </tr>
                </table>
            </fieldset> 
        <!--/APPLE DEFAULT FONT HACK-->


Deimos 08-19-2005 09:57 PM

I can get the font type and colour to change, but when I add additional font sizes, they don't seem to work?

applehat 08-31-2005 02:54 AM

donno? Post up your template and maby someone can help :-O

Mijae 10-01-2005 09:28 PM

Can you add an option to ignore these settings? I want my users to be able to use this, but I hate it :P

VaaKo 10-04-2005 06:38 PM

when I try to load the xml file in the plugin manager, it gives me this:

Code:

XML Error: XML_ERR_RESERVED_XML_NAME at Line 1

Thug 10-23-2005 07:18 PM

great hack

eNforce 10-23-2005 07:54 PM

Working fine for me on Gold :)

Samira 10-25-2005 06:20 AM

Quote:

This releace does not have the plugin required to get the defaults for a user back out of the database so that users dont have to reset there defaults every time they visit the options page. If you want to write this part, be my guest. (Because I realy dont know how.)
Anyone?

eNforce 10-29-2005 05:44 PM

Quote:

Originally Posted by Samira
Anyone?

I agree, someone needs to code that. It's the only issue I'm having at the moment.

applehat 10-30-2005 09:48 PM

Well, Im busy with work, but I could probly right it now. I know more PHP.

Anyone feel free to write this thow...

Also, if I do write it, ill probly end up doing a complete recode...

I guess look for a "version 2" sometime soon.

sully02 11-28-2005 02:26 AM

Quote:

Originally Posted by applehat
Well, Im busy with work, but I could probly right it now. I know more PHP.

Anyone feel free to write this thow...

Also, if I do write it, ill probly end up doing a complete recode...



I guess look for a "version 2" sometime soon.

Got a bug with this one...

My users are experiencing issues with changing fonts when they don't want them to be changed, or when they weren't trying to change them in the first place.

One of my users went into Edit Options to change the style he was using to view the board, and then his font was at Arial, 1 pt., Black. Can't reset it back to normal, now.

Bubble #5 11-29-2005 07:08 AM

Quote:

Originally Posted by applehat
I guess look for a "version 2" sometime soon.

Looking forward to it :nervous:

applehat 11-29-2005 07:04 PM

haha...forgot about this...maby ill be cool and code it tonight...

eNforce 11-29-2005 07:47 PM

That would be most excellent

sully02 11-30-2005 01:05 AM

Quote:

Originally Posted by applehat
haha...forgot about this...maby ill be cool and code it tonight...

I'll definitely reinstall this should a version 2 become complete!

JayJay 11-30-2005 01:18 PM

I look forward to it.

applehat 12-01-2005 08:47 PM

hmm....Im gonna drop this...ITs so easy with custome user fields...

I might do a write up on how to make it look better later thow ....

sorry guys.

VaaKo 12-02-2005 03:24 PM

is there a way to add the bold/italic option as well?

VaaKo 12-02-2005 03:38 PM

and also is there a way to add a blank option for those who'd like to restore the default vbulletin font face?

VaaKo 12-02-2005 06:04 PM

there is something wrong which I'd like to see fixed
when user for example selects the default font to be "verdana" and clicks submit, when the page reloads, the first color which in that case is "Arial" is shown instead of the selected font which is verdana

can you fix that?

ffevo 03-05-2006 05:54 AM

Anyway, That my memebers could just type in a color? and it will update to the database?

rockerBOO 03-10-2006 01:58 PM

I would suggest this to be instead of the font tag >_>

PHP Code:

2Open Postbit Templates -> postbit (or postbit_legacy)

FIND:
    
$post[message


There may be DIV tags around itleave those alone!

REPLACE WITH:

    <if 
condition="$post[deffont] || $post[defsize] || $post[defcolor]">
        <
span style="font-family: $post[deffont]; font-size:$post[defsize]; color: $post[defcolor];">$post[message]</span>
        <else />
        
$post[message]
    </if> 

also for you ffevo

PHP Code:

 <select name="defcolor" id="sel_defcolor">
                            <
option value="Black">Black</option>
                            <
option value="Blue">Blue</option>
                            <
option value="Red">Red</option>
                            <
option value="Green">Green</option>
                            <
option value="Orange">Orange</option>
                            <
option value="Yellow">Yellow</option>
                            <
option value="Pink">Pink</option>
                        </
select

replace that in the hack with

PHP Code:

 <input type="text" size="20" name="defcolor" id="sel_defcolor" /> 


Nathan2006 06-10-2006 05:17 PM

Thank you applehat

Working really well

Install :)

MissKalunji 08-05-2006 12:43 PM

is it working with 3.6?

bchertov 09-05-2006 05:09 PM

Quote:

Originally Posted by MissKalunji
is it working with 3.6?

Bump! (work in 3.6?)

And what's the state of this hack? Does it use custom user fields or? Support Bold/Italic? Color?


Thanks!
Barry

Zelos 09-06-2006 09:53 PM

I'd also like to know if this works in 3.6.

NoKz 09-07-2006 07:12 AM

I have it installed and working great with 3.6. Thanks for this! :cool:

dknelson 09-24-2006 10:07 AM

I've just installed it on 3.6.1 and it works fine. Sure wish this hack hadn't been dropped though. There are a couple of things needed to complete it.

1. When the options are set, I wish it would retain them when you go back to view your set options.

2. I wish there was a "default" option at the top of each list so that a user could go back to default if they desire.

SnapOff Racing 02-19-2007 12:35 PM

anyone know if this hack or one idential has a bold option?

apiasto 02-22-2007 03:35 AM

great work been looking for it very easy to install thanx. wont mind the bold option


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

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.01666 seconds
  • Memory Usage 1,911KB
  • 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
  • (3)bbcode_code_printable
  • (7)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete