#1  
10-14-2012, 03:30 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
As many people know, The Digital FAQ will rescue forums in danger of disappearing, and generally upgrades them to vBulletin as part of the takeover process. Most also get a complete facelift/redesign. All of the sites we rescue have good content -- but maybe didn't have the best design or design-oriented moderation considerations. On some of the sites we've taken over, users and mods/admins alike would commonly use ridiculous large font sizes on posts, which was really nothing more than hard-to-read digital screaming.

In this example, we'll be replacing font sizes 4,5,6,7 with font size 3, which is the max size we need.
For example, the headings below are bolded blue size 3. Plenty large to get the point across (i.e., headings for sections).


Step 1 - Add Replacement Variables

This takes care of the display/editing of all existing font bbcode on the forum.

In the vBulletin admin (aka "admincp", which you've hopefully changed), under the Styles & Templates, is the Replacement Variable Manager. You'll want to add replacements for each font size.
  • In the "search for text" box, add the old size. For example, [size=7]
  • In the "replace with text" box, add the new size. For example, [size=3]
Repeat this for each size that you would like to limit/replace:
  • [size=4]
  • [size=5]
  • [size=6]
  • [size=7]
That takes care of the editor replacements. However, for the display replacement, you'll need to add more variables:
  • In the "search for text" box, add the old size. For example, <font size="7">
  • In the "replace with text" box, add the new size. For example, <font size="3">
Repeat this for each size that you would like to limit/replace:
  • <font size="4">
  • <font size="5">
  • <font size="6">
  • <font size="7">
Optional: On the site being worked on today, I've added a margin to the headings font size as well. (Font size 3 is what we consider "heading fonts" in our forums. And in fact, font size 3 itself was replaced with the version that added spacing.)

Replacement text:
Code:
<div style="margin-top:8px;"></div>
<font size="3">
There's actually quite a few ways replacements can be altered -- all more advanced than the basic example shown here -- and savvy users can probably figure them out on their own. If you wouldlike to try more complex replacements, and need help, feel free to post here.


Step 2 - Edit vbulletin_textedit.js

This takes care of any new posts made on the forum, by editing what font sizes are available in the post editor.

In the /forum/clientscript/ folder, edit vbulletin_textedit.js with a plain text editor. Some versions of this file are minified (on a single line), so use the find/search function in the editor. Locate the code this.translate_fontsize=function(csssize), which is the beginning of the full font script section:

Code:
this.translate_fontsize=function(csssize)
{switch(csssize)
{
case"7.5pt":case"10px":return 1;
case"10pt":return 2;
case"12pt":return 3;
case"12pt":return 4;
case"12pt":return 5;
case"12pt":return 6;
case"12pt":return 7;
default:return""
}
};
^ Notice that this code snippet is already altered for "12pt" for sizes 4-7, to match size 3.

You can simply delete unwanted sizes. In this example, I chose to merely change the size. Both methods work perfectly.


And that's it.


_____________________


Need a good web host? — Read our 2018 Review of the Best Web Hosts
Quite often, problems with web sites are caused by having a rotten web host. Worse yet, many hosts try to blame you (the customer) for the problems! So dump that lousy company. Say goodbye to slow sites, unresponsive support techs, and downtime. Find yourself a new host today. Whether you need shared, reseller, VPS, semi-dedicated, cloud, or dedicated hosting, something on our list should be a good upgrade for you.


- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL query to change thread icons in vBulletin admin Website and Server Troubleshooting 1 05-10-2014 09:27 PM
New before/after images bbcode for forum admin General Discussion 3 12-18-2011 07:15 AM
Widen [code] box in vBulletin forum, change style to increase width kpmedia Website and Server Troubleshooting 0 07-25-2011 07:14 AM
Resize displayed images in vBulletin 3.x, [IMG] bbcode hack admin Website and Server Troubleshooting 0 06-01-2011 04:20 AM
Change sticky color in vBulletin themes admin Website and Server Troubleshooting 2 07-13-2010 02:22 PM

Thread Tools



 
All times are GMT -5. The time now is 09:28 AM