PDA

View Full Version : Automatic Post Coloring


Palmer ofShinra
11-03-2001, 10:00 PM
This is a simple little hack taht allows users to specify a color by name or hex code in theor profile.

If they do (we'll use limegreen as the color they chose for examples) then all their posts from that point on will have
[color=limegreen ] and [/color ] surrounding them.

It does not retroactively affect previous posts. Only new ones.
If they post as limegreen for a day, then change to red, all their limegreen posts stay that way.

The hack involves adding 3 lines of code to 2 different files (same 3 lines for both files) and creating a Custom Profile field.

TheComputerGuy
11-04-2001, 10:12 AM
Do you have like a screen shot of it

Palmer ofShinra
11-04-2001, 06:21 PM
You can't take a meaningful screenshot of this...

All it does is make all of a user's posts show up in a certain color automatically.

That's all.

Diva
11-05-2001, 04:00 AM
Does this also show the colors in the 'Whos online area?

Reeve of shinra
11-05-2001, 10:35 AM
All this does is automatically place the [color=??] tag around the entire post so the user doesn't have to type it out each and every time. It becomes a default choice.

Mike Gaidin
11-06-2001, 03:19 AM
Nice one. :D

I installed it and it works great.

Twizted
11-08-2001, 12:17 AM
for some reason... i either don't understand the code or im just stupid -.-

newayz, here is the part i don't get..

STEP 3:

In newreply.php

Find:
============
} else {
if ($attachmentid and !$foruminfo[moderateattach]) {
$DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
}
============

And in newthread.php

Find:
============
// subscribe to thread
if ($email and $bbuserinfo['userid']!=0) {
if (!$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$bbuserinfo[userid] AND threadid=$threadid")) {
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$bbuserinfo[userid],$threadid)");
}
}
============

STEP 4:

Directly underneath those, before the query, add this (same code for both files)

// attempt at auto-surround post with tags
if ($bbuserinfo[changeme]!="") {
$message = "."]".$message."";
}
============

can someone show me an example of where to stick step 4 at?? like an exact example of where it goes... b/c im stuck... :mad:

Parse error: parse error in /home/twisteda/public_html/forum/newreply.php on line 249

that comes up when i go to new reply...

Twizted
11-08-2001, 12:18 AM
btw... does this work for vbulletin 2.2.0???

that is what im tryin to install it on now

Mike Gaidin
11-08-2001, 12:29 AM
Yes, it works great with 2.2.0.

heretic
11-08-2001, 09:23 PM
Not for me. I have 2.2.0 and for some reason, all the tags ended up

blahblahblah

instead of (well, mine would be)

blahblahblah

Twizted
11-08-2001, 11:06 PM
Originally posted by J-OST
Yes, it works great with 2.2.0.

you must have installed it then right?

could u pleaz help me out and tell me where to put the new part of the code at???

:(

Reeve of shinra
11-09-2001, 01:25 AM
Step three has two parts ....

A) open newreply - find what it asks for then copy / past over the info from step 4.

B) open Newthread.php - find what it asks for then copy paste over the same information you pasted found in step 4.

Remember that 'changeme' must read field5 or field6 or field437 or whatever ...

Reeve of shinra
11-09-2001, 01:28 AM
heretic - make sure you have the right field selected. ie field5.

Twizted
11-09-2001, 03:12 AM
it said

Directly underneath those, before the query, add this (same code for both files)

do i add it right under that part of the code.. or into the middle of that code???

the original code is

} else {
if ($attachmentid and !$foruminfo[moderateattach]) {
$DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
}


so would i make it go right under it like this


} else {
if ($attachmentid and !$foruminfo[moderateattach]) {
$DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
}
// attempt at auto-surround post with tags
if ($bbuserinfo[changeme]!="") {
$message = "."]".$message."";
}


or before the query in it?

im confused right now -.-

Twizted
11-09-2001, 03:20 AM
awesome it works

:p

Ed FvC
11-09-2001, 03:59 AM
This is pretty sweet. :D How about adding a default font face, too? I'm always typing font=trebuchet ms color=#99cc00...gets rather old.

Great hack!

heretic
11-09-2001, 03:22 PM
Originally posted by Reeve of shinra
heretic - make sure you have the right field selected. ie field5.



yes, I was sure.

I'll try it again.

Mike Gaidin
11-09-2001, 08:05 PM
Sorry I didn't see this sooner Twizted. I'm glad it's working for you now. :)

Reeve of shinra
11-09-2001, 10:44 PM
You can actually change it to font face very easilly by repeating the same steps and changing the surrounding tags in the hack part. You will see what I mean....

Logan
11-09-2001, 11:02 PM
I really like this. Good job!!!

Ed FvC
11-09-2001, 11:49 PM
Originally posted by Reeve of shinra
You can actually change it to font face very easilly by repeating the same steps and changing the surrounding tags in the hack part. You will see what I mean.... Yeah, but I'm lazy. ;) I just figured it'd be good for the next version (if you plan on updating). Thanks again for a nice hack.

Palmer ofShinra
11-10-2001, 10:44 AM
Well, i'm glad to see people like this... it sat here for several days with no one relpying or installing it...

Yeah, it's pretty simpistic, but it's nice and people like it.

One of our members had fun annoying everyone... our table colors are #222222 and #333333

He used this and set it to #222222 so you could barely read what he wrote... or not at all!

For font... it's just the same. Just change all occurances of the word color to font...

It should be easy if you read the code.

The Realist
11-10-2001, 11:35 AM
Works great on version 2.2.0 as well.

:)

Dalius
03-01-2002, 09:59 PM
2.2.2 version please!

Austin Dea
03-01-2002, 10:39 PM
erm....is it just me or does this hack seem way too involved....all i did was:

-added the profile field 'Color'

And in the postbit template, I replaced this
<p><normalfont>$post[message]</normalfont></p>

with
<p><normalfont><FONT COLOR="$post[field5]">$post[message]</font></normalfont></p>

of course, the [field5] should be changed to whatever that field # is..

Did I miss something, does this hack do something different?


and this should work on any version....i don't see any reason why not...

OldManWillow
03-02-2002, 12:47 PM
AD your hack worked for me just fine thanks!

Austin Dea
03-03-2002, 12:55 AM
w00t...:P

Zedd
04-05-2002, 02:51 AM
that was easy! thanks

inetd
05-04-2002, 05:56 AM
Palmer ofShinra, please add color bar for color choice. ;) It's be very cool!

Example here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=3725)

Unknown553
05-04-2002, 06:50 PM
Originally posted by Austin Dea
erm....is it just me or does this hack seem way too involved....all i did was:

-added the profile field 'Color'

And in the postbit template, I replaced this
<p><normalfont>$post[message]</normalfont></p>

with
<p><normalfont><FONT COLOR="$post[field5]">$post[message]</normalfont></p>

of course, the [field5] should be changed to whatever that field # is..

Did I miss something, does this hack do something different?


and this should work on any version....i don't see any reason why not...
Even that is too involed....you can just use <p><normalfont color="$post[field5]">$post[message]</normalfont></p>
No need for two <font> tags.

Austin Dea
05-04-2002, 08:54 PM
Oh my god. You took out 6 characters.

Oh wow, that's still wrong. Should be

<p><normalfont><font color="$post[field5]">$post[message]</font></normalfont></p>

So I guess you took out 13 characters =P.

KuraFire
05-05-2002, 08:14 AM
Austin Dea, what're you talking about??

<p><normalfont color="$post[field5]">$post[message]</normalfont></p>

works just fine, no need for 2 font tags (<normalfont> is a font tag, you can just add ` color="whatever"` to it...).

However, doing this through Template changes only, will mess things up if a user doesn't enter anything in the field. If the field is left blank, with some browsers the font color will be made BLACK. If you're running a black-bg board with white text, that's not a fun thing. :)

The idea of this hack is nice, but it can be improved easily. In showthread.php, find:

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

add beneath that:


if($post[fieldX]!=""){
$color_on = "<font color=\"$post[fieldX]\">";
$color_off = "</font>";
}else{
$color_on = "";
$color_off = "";
}

Now add
$color_on and $color_off around $post[message] and it'll work.

If a user doesn't enter anything, their posts will be default color. If they do, their posts (ALL their posts, including their former posts, made before you implemented this hack) will show up in the chosen color.

Austin Dea
05-05-2002, 03:33 PM
I know it works just fine, I was just saying that the one I posted needed fixing =P.

And if you don't enter anything on my boards, it puts it as the default color...and on at least 3 other board I've seen using this method :).

MrBojangle1
05-05-2002, 07:58 PM
Well i like this hack i have it installed on my vB it is worth getting

KuraFire
05-06-2002, 08:37 AM
AD: yes, but some (older) browsers might mess it up.

Anyhoo, the hack at the top, by Palmer, is just plain bad. Afterlab has it installed on FFR, and in my browser all users who use the hack, will have their posts show up in default color, TIMES NEW ROMAN. No colors, nothing, just an ugly TNR font. Quite annoying... :(

ZiRu$
05-06-2002, 08:25 PM
seems like a good hack! I'll install it later! Good Work! I'd like the "Different Fonts" add-on too.......

JackDawson
06-05-2002, 03:10 PM
Great Hack! Thx ..

Jacky

Diva
07-21-2002, 09:23 PM
KuraFire, I was wondering about one section of your updated version. Where you say:
Now add
$color_on and $color_off around $post[message] and it'll work.
Where exactly am I to place this? I love this hack, but I would like all posts to change colors.

Thanks bunches in advance.

[D]Vincent
08-01-2002, 09:21 AM
You're suppose to put it in Admin CP > Templates > Modify > Style that you want to modify > Postbit Templates > postbit and then find the $post[message] and do as he said.

ZiRu$
08-01-2002, 03:08 PM
Originally posted by ZiRu$
seems like a good hack! I'll install it later! Good Work! I'd like the "Different Fonts" add-on too.......

I shall Re-Install it again :)

Diva
08-24-2002, 08:41 PM
Originally posted by [D]Vincent
You're suppose to put it in Admin CP > Templates > Modify > Style that you want to modify > Postbit Templates > postbit and then find the $post[message] and do as he said.

Let's try this one more time. :tired:

Now add
$color_on and $color_off around $post[message] and it'll work.

Around meaning:
1. Somewhere around the line [above or below it]

or

2. Literally within that line:
<p><normalfont color="$post[field5]">$color_on $post[message] $color_off</normalfont></p>

Keep in mind that I do not do hacks, just follow the instructions and enjoy the results.

Austin Dea
08-25-2002, 12:18 AM
It should be just <p><normalfont>$color_on$post[message]$color_off</normalfont></p> if you used that code hack from KuraFire. Be sure to change the X in 'fieldX' to the field number you created.

Diva
08-25-2002, 03:12 AM
thank you!

Darth Cow
08-25-2002, 07:09 AM
Thanks... I guess :p. Some of my users have been doing this thing on their own for while manually, and it does get a bit annoying, so they've been bugging me for this for a while. Of course, I have better things to spend my programing time on than adding useless tasteless features, those I suppose there isn't any additional harm. I might have actually done it on my own, but I didn't realize how easy adding an optional profile field like this is :cool:.

EDIT: Actually, I'd like to humbly recommend a slight change in this script, adding the code before the following instead where it was previously:

$subject=censortext($subject);
$message=censortext($message);

That will insure that someone can't just make their color "black[/font]" and procede to add whatever cuss words they feel like :).