vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   User Default Font/Color/Size hack (https://vborg.vbsupport.ru/showthread.php?t=49398)

TalkHardRandy 02-25-2003 10:00 PM

User Default Font/Color/Size hack
 
First hack... please be gentle :confused: :

WHAT IT DOES:

It allows the user to specify in their profile what size, color and font that they wish to use in all their posts. This is esentially the same as surrounding stuff with SIZE, COLOR, FONT, but makes it easier.

It also uses the vbcode templates already in the system, so users can select from any of the fonts & colors you have already defined. This avoids users inputing colors that don't exist and fonts that no one else has on their systems.

INSTALLABLES

3 file mods
4 template adds
3 template mods

PROPS

Palmer ofShinra inspired the original version here, so massive props to him. I wanted to take his idea and make it more user friendly (and was tired of trying to explain to people why 'puke green' didn't work as a color).

Also, every other hacker out here (Lesane, Erwin, FireFly, Xenon, C.Birch, futureal, and a hundred others) for busting their butts and putting hacks out and for saying that if you want to do something, learn to do it. Inspiration at its finest.

BUGS

If you run TomBot, TomBot has a problem with the FONT/COLOR/SIZE tags. The fix is two posts below

Okay... let me know

FIXES

1) Fixed Spelling of 'Verdana' - Thanks Vivi!
2) Fixed for Multiple Styles - Thanks Zelda!
3) Added & fixed user ability to use default via ON/OFF - Again, Thanks Zelda!
4) Added ability to remember defaults.

TalkHardRandy 02-26-2003 07:44 PM

What it looks like in the User CP...

TalkHardRandy 02-26-2003 07:50 PM

Okay, if you're like me your running TomBot & you've figured out that he/she doesn't like the color, font, size tags... especially if you're teaching to it.

In both newreply.php & newthread.php, find this section:

PHP Code:

// #####################  BEGIN FONT COLOR SIZE HACK ##################
    
if ($bbuserinfo[default_fcs]="0") {
        
$message "[color=".$bbuserinfo[post_color]."][font=".$bbuserinfo[post_font]."][size=".$bbuserinfo[post_size]."]".$message."[/size][/font][/color]";
    }
// #####################  END FONT COLOR SIZE HACK #################### 


Replace it with:

PHP Code:

// #####################  BEGIN FONT COLOR SIZE HACK ##################
    
if ($foruminfo['forumid']!=="FORUM#" || $bbuserinfo[default_fcs]="0") {
        
$message "[color=".$bbuserinfo[post_color]."][font=".$bbuserinfo[post_font]."][size=".$bbuserinfo[post_size]."]".$message."[/size][/font][/color]";
    }
// #####################  END FONT COLOR SIZE HACK #################### 

Where FORUM# is the forum where your TomBot is running. If you have multiples, and a ||. To figure out what forum you TomBot is running in, check the tomstalkerbot.php for the $ttb_forumid variable.

NOTE: If it doesn't look like this in your files, you need to go back to post #1 and reinstall the hack.

Vivi Ornitier 02-26-2003 09:23 PM

hey great job! been waitin for somethin like this but the queries don't wokr.

I thin it's too many ' and also u spelt Veranda instead of Verdana in the queries

TalkHardRandy 02-26-2003 09:30 PM

Okay... spelling bugs are fixed (which is why Notepad should have a spell checker :nods: )

As for the query, I don't know why it wouldn't work... I copied and pasted it out of MySQL and tried it again... :confused:

This is what my results look like... what about yours?

Disturbed 02-26-2003 11:40 PM

i will test this locally and report you the results :)

One-Team 02-27-2003 01:51 AM

Great Hack
I will Install it :banana: :banana:

Zelda-King 02-27-2003 10:03 AM

I'm trying this out on vB 2.2.9.

Good hack. One snag though. There are 16 of each option beside each other. Also the number of times the options are indicated goes up by 1 as you go along. So in the first size one it says 'small medium large' then in the next one it says 'small medium large small medium large' and so on. (I got rid of the LARGER font sizes. I don't like seeing posts in like size 5+ font or something personally. :D)

Here, I took a screenshot of the bug (see attachment).

It's something to do with the member.php because if I revert that file the templates work fine.

EDIT: I fixed it. Basically, instead of using
PHP Code:

eval("\$getfontcolor.= \"".gettemplate("vbcode_colorbits")."\";");
eval(
"\$getfontsize.= \"".gettemplate("vbcode_sizebits_mod")."\";");
eval(
"\$getfontfonts.= \"".gettemplate("vbcode_fontbits")."\";");

eval(
"\$postfontcolor.= \"".gettemplate("post_font_color")."\";");
eval(
"\$postfontsize.= \"".gettemplate("post_font_size")."\";");
eval(
"\$postfontfonts.= \"".gettemplate("post_font_fonts")."\";"); 

use
PHP Code:

eval("\$getfontcolor = \"".gettemplate("vbcode_colorbits")."\";");
eval(
"\$getfontsize = \"".gettemplate("vbcode_sizebits_mod")."\";");
eval(
"\$getfontfonts = \"".gettemplate("vbcode_fontbits")."\";");

eval(
"\$postfontcolor = \"".gettemplate("post_font_color")."\";");
eval(
"\$postfontsize = \"".gettemplate("post_font_size")."\";");
eval(
"\$postfontfonts = \"".gettemplate("post_font_fonts")."\";"); 

.

You just shouldn't have the '.'s before the '='s.

The trouble is this can pose problems for boards that have several styles. If the top 'default' option was truly 'default' and didn't insert any vB code that would be perfect.

I was thinking something along the lines of
PHP Code:

// #####################  BEGIN FONT COLOR SIZE HACK ##################
        
if($bbuserinfo[post_color] == "Default"){
$message "[font=".$bbuserinfo[post_font]."][size=".$bbuserinfo[post_size]."]".$message."[/size][/font]";
} else {
$message "[color=".$bbuserinfo[post_color]."][font=".$bbuserinfo[post_font]."][size=".$bbuserinfo[post_size]."]".$message."[/size][/font][/color]";
// #####################  END FONT COLOR SIZE HACK #################### 

but that is parsed wrong in the top line. Needs correcting. That code just gets me an unexpected T_DEFAULT.

TalkHardRandy 02-27-2003 03:25 PM

Okay... fixed the file with your first fix Zelda... danke.

As to the second part, I'm going to put an on/off button in there so people can select which features they wish to use. It'll double the options in the CP and make the newreply & newthread parts bigger, but you're right it is kinda a pain...

Dean C 02-27-2003 03:31 PM

Nice hack Randy. I saw this and thought you would have had a numeric field to enter for the font size. It's in dropdowns which i would have suggested anyway. Excellent hack pal :)

- miSt


All times are GMT. The time now is 10:13 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.01200 seconds
  • Memory Usage 1,767KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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