vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Shrink Old Posts in Thread (https://vborg.vbsupport.ru/showthread.php?t=33060)

bira 12-08-2001 10:00 PM

Hi all,

This is a brand new addition to my own BB, so I don't even know how my own users will react to it, let alone how you guys would :)

Hack Description:
  • Posts you have already read in a thread, will show up with their header only (a row that includes the username, post subject and date only). New posts only will appear in full.
  • This is user selectable via the 'Edit Options' page: each user can decide if he wants this option on or not. (By default all existing and new users will have this turned Off).
  • A link at the top of the thread offers to "expand all" posts or "contact all" posts.
  • by clicking on the + sign on a shruk post, it will expand without the page reloading. By clicking on the - sign on an expanded post, it will shrink without the page reloading.
  • [high]this option is available for your IE users only! Netscape users will see no difference and will not be affected anyway at all by the change[/high]
How to install:
  • Please download the attached zipfile.
  • Upload plus.gif and minus.gif to your images directory
  • Upload install_contractposts.php to your admin directory and run that script.
Note: there are quite a few changes to make (primarily additions, not replacements) to the vb scripts and templates. The process should take you several minutes, so I recommend you close your Bulletin Board while installing the hack.

Demo:

You are welcome to visit my Bulletin Board, at http://www.atlasf1.com , to see what the additions look like. To test it in full (ie, the option of old posts being shrunk by default), you will have to register and modify your options after you have received your password.

Cheers,

Bira

bira 12-09-2001 02:25 AM

here's a screen capture of what it would look like if a user selected to contract old posts:

http://www.atlasf1.com/personal/bira...tractposts.gif

(This is on a clean, default vBulletin style/design. My BB has a slightly different style, which is why I am also including this image above)

Hooper 12-09-2001 02:27 AM

Wow Bira. Your going to town on these hacks lately. :D

Going to install tonight!

Hooper 12-09-2001 02:31 AM

All I can say is that it works and looks wonderful on your site.

Thank You. :D

bira 12-09-2001 02:34 AM

that's cool, thanks :)

FWC 12-09-2001 02:54 AM

Bira, I registered on your site to see how it worked. Very cool!! :D

bira 12-09-2001 05:44 AM

ok, if you installed this hack on 2.2.1 there's a small change.

If you haven't installed this hack, or installed it on 2.0.3, ignore this post.

In root/register.php

find this:

Code:

// Contract Old Posts in Thread (v1.0)
    $DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invisible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts,startofweek,ipaddress,pmpopup,referrerid,nosessionhash[high],avatarid[/high],hideposts) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes([high](md5[/high]$password)[high])[/high]."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash'[high],'$avatarid'[/high],'$hideposts')");
// Contract Old Posts in Thread (v1.0)

And add to it the code highlighted in the above line.

Sorry about this - I initially tested this on 2.0.3, and having tested it now on 2.2.1 as well - I noticed the ',avatarid' md5()and ".'$avatarid'" are missing from this query :)

Crinos 12-09-2001 09:06 AM

Hmmm, I'm getting this error when I try to run install_contractposts.php:

Parse error: parse error in /home/username/public_html/forums/admin/install_contractposts.php on line 278

bira 12-09-2001 09:14 AM

Sorry about that Crinos. Please download the zip file again - I corrected that mistake (forgot to espace the ' in that line :/)

Crinos 12-09-2001 09:55 AM

Thanks bira ...

I just finished installing it on my test board, but now I get this error when I try to click a thread from forumdisplay.php:
Code:

Parse error: parse error in /home/username/public_html/forums/showthread.php on line 401
I looked for that line, and this is what it contained (lines 398-408)
PHP Code:

$counter=0;
$countposts = ($pagenumber-1)*$perpage;
while (
$post=$DB_site->fetch_array($posts) and $counter++<$perpage) {
  if (
$postdoneery(st[postid]]) {
    
$counter--;
    continue;
  } else {
    
$postdone[$post[postid]]=1;
  }
  
$postbits .= getpostbit($post);


Any idea what I did wrong on this one? Thanks in advance :)

bira 12-09-2001 10:02 AM

Crinos,

This has nothing to do with my hack, which changes nothing in these lines.

However, looking at the code you posted, it looks like like 401 in your showthread.php has gone completely awry.

The correct (original) line should be:

PHP Code:

if ($postdone[$post[postid]]) { 


Crinos 12-09-2001 10:09 AM

duh! I didn't know what the hell happened to that code right there, but it was pretty whacked out ... thanks for the fix ...

The hack works great! Excellent work ... my users are gonna like this, hehe ... I'll install it on my main board tomorrow night ... you're right, this hack takes some time to install.

Great work, as usual :)

bira 12-09-2001 10:16 AM

Thanks :)

Hooper 12-09-2001 10:18 AM

My installation didn't work. I think I'm going to have to go back through this whole thing.

It doesn't expand and contract and the images are not showing up at all. :(

I have such a hacked up site it's hard to find the code to edit.

bira 12-09-2001 10:23 AM

Hooper,

1) Make sure you follow the instructions in the installer to a T

2) Remember that this will only work on IE. If you are viewing your forums with Netscape or any other browser than IE, you won't see any difference at all.

Cheers,

Bira

bira 12-09-2001 03:42 PM

Hooper,

E-mail me at goren@atlasf1.com the following files, and I'll make sure the hack is installed correctly and return them to you.

1) member.php
2) register.php
3) showthread.php
4) admin/functions.php

5) txt file of your postbit template
6) txt file of your showthread template

Cheers,

Bira

Modshack 12-09-2001 05:39 PM

Installed and working fine on my forumz :) thanks Bira.

Justa thought but this would be realy kewl if the threads autocollapsed if the thread was older than maybe 30 days or so.

Anyhow just a note to say ta

HM

Hooper 12-09-2001 08:46 PM

Hi Bira,

You offer is very kind and I decided to take you up on it. The files are sent. I went over the hack installation briefly yesturday evening and found that within the showthread.php there is a bit of your hack code that is installed right below a portion of a news type hack I have installed. This may be posing a problem but I'm not sure. At this point I have a minimum of 10-12 hacks installed and a couple of the files such as functions and showthread are getting interesting when trying to install another hack. Heh, you almost have to be a hack writer yourself when you get to this point.

Regardless, I appreciate you taking a look to see if it is something on the simple end or if I have a clash in code between hacks or between the several javascript apps I have installed. Most likely I just missed something somewhere.

Thank You,
Rick

Hooper 12-09-2001 10:36 PM

[QUOTE]Originally posted by Modshack
Installed and working fine on my forumz :) thanks Bira.

Justa thought but this would be realy kewl if the threads autocollapsed if the thread was older than maybe 30 days or so.

Anyhow just a note to say ta

HM

bira 12-10-2001 01:29 AM

Hi Rick,

Did you send it? I didn't receive it (I just woke up, heh).

goren@atlasf1.com - just to be sure.

Cheers,

Bira

Hooper 12-10-2001 01:53 AM

Hi Bira,

Yes I sent it. I also went ahead and just sent it again. Darn email. :D I've always wondered where half the email goes when not received. Does it like just set out in cyberspace between deminsions..Lol.

bira 12-10-2001 01:57 AM

I got it. Will look into it now right away :)

Hooper 12-10-2001 02:07 AM

[QUOTE]Originally posted by bira
I got it. Will look into it now right away :)

bira 12-10-2001 02:26 AM

Hooper - sent you the stuff edited back :)

Hooper 12-10-2001 03:19 AM

*Hooper goes and crawls under rock after the talented Bira shows Hooper that he left code out of the templates thus creating buggies. :o *

I really should sleep more. Everything seems to be super duper.

Thanks Bira,
Much Appreciated.
Rick

bira 12-10-2001 03:27 AM

My pleasure. Glad it works :)

Hooper 12-10-2001 03:28 AM

And that it does. :)

Thanks again for sharing your work.

Rick

Baratator 12-10-2001 11:09 AM

greaaaaaaaaaaaaaaaaaaaaaat hack !!!!

jsut one thing... can you make it not srhink the fist post ?

I mean generally there is one post and a lot of replys and when you wiew it all the read replys are skunk but the riginal post too... the first one if you see what i mean...

thx this is a really useful hack !!

bira 12-10-2001 11:30 AM

ok, I was asked about two other hacks I wrote, and how to integrate
them with this hack, so here goes:

1) The
"
Who Posted" enhancement
hack ('showposts').

If you installed my hack variation - of using a separate,
showposts.php file (rather than hacking showthread.php) - you will
need to do two small changes to showposts.php:

a) Find

Code:

$pagenav = getpagenav($totalposts,"showposts.php?s=$session[sessionhash]&threadid=$threadid&postuserid=$postuserid&perpage=$perpage");
Change to (addition marked in high):

Code:

$pagenav = getpagenav($totalposts,"showposts.php?s=$session[sessionhash]&threadid=$threadid&postuserid=$postuserid&perpage=$perpage[high]&display=$display[/high]");
b) Find

Code:

getforumrules($forum,$getperms);
ABOVE that ADD:

PHP Code:

// Contract Old Posts in Thread (v1.0)
if (strstr($HTTP_USER_AGENT,"MSIE")) { 
  eval(
"\$hideposts = \"".gettemplate("showthread_hideposts")."\";");
 } else { 
    
$hideposts "";
 }
// Contract Old Posts in Thread (v1.0) 

That's it. Save and upload file.

2) The
P
ost Count & Direct Link
hack ("post #xxx");

This is more a design explanation than an actual hack integration.

I will explain to you what changed in the postbit template. That will
assist you in integrating any post you want, not just the count post
hack.

The "Contract Old Posts" hack changes bpostbit only in that it
adds a division (<div></div>) and defines the traditional postbit as a
division. So the new postbit looks like:

Code:

<table bgcolor="{ pagebgcolor }" width="{ tablewidth }" cellpadding="0" cellspacing="0" border="0"><tr><td width="10"><img width="10" height="1" src="{ imagesfolder }/space.gif" alt=""></td><td width="100%"><!-- spacer -->

<table cellpadding="{ tableouterborderwidth }" cellspacing="0" border="0" bgcolor="{ tablebordercolor }" { tableouterextra } width="{ contenttablewidth }" align="center"><tr><td>

<DIV id="p$post[postid]h" style="display:$ph">
<table cellpadding="4" cellspacing="{ tableinnerborderwidth }" border="0" { tableinnerextra } width="100%">
<tr>
        <td bgcolor="$post[backcolor]" width="175" valign="top" nowrap>$plusimg        <normalfont><b>$post[username]</b></normalfont></td>
        <td bgcolor="$post[backcolor]" width="100%" valign="top">
                <table width="100% cellspacing="0" cellpadding="0" border="0">
                <tr>
                <td><smallfont>$post[icon] <b>$post[title]</b></smallfont></td>
                <td align="right" nowrap><smallfont>$onlinestatus $post[foldericon] $post[postdate] <font color="{ timecolor }">$post[posttime]</font></smallfont></td>
                </tr>
                </table>
        </td>
</tr>
</table>
</DIV>


<DIV id="p$post[postid]e" style="display:$pe">
<table cellpadding="4" cellspacing="{ tableinnerborderwidth }" border="0" { tableinnerextra } width="100%">
<tr>
        <td bgcolor="$post[backcolor]" width="175" valign="top" nowrap>
        <a name="post$post[postid]"></a>
        $post[firstnewinsert] $minusimg
        <normalfont><b>$post[username]</b></normalfont><br>
        <smallfont>$post[usertitle]</smallfont><br>
        $post[avatar]<p>
        <smallfont>Registered: $post[joindate]<br>
        Location: $post[field2]<br>
        Posts: $post[postcount]/$post[posts]</smallfont></td>
       
        <td bgcolor="$post[backcolor]" width="100%" valign="top">
        <smallfont>$post[icon] <b>$post[title]</b></smallfont>
        <p><normalfont>$post[message]</normalfont></p>
        $post[attachment]
        <p>$post[signature]</p>
        <p>$post[editedby]</p>
        <p align="right"><smallfont><a href="report.php?s=$session[sessionhash]&postid=$post[postid]">Report this post to a moderator</a> | $post[iplogged]</smallfont></p>
        </td>
</tr>
<tr>
        <td bgcolor="$post[backcolor]" width="175" height="16" nowrap><smallfont>$post[postcount] $onlinestatus $post[foldericon]
        $post[postdate]
<font color="{ timecolor }">$post[posttime]</font></smallfont></td>
       
        <td bgcolor="$post[backcolor]" width="100%" valign="middle" height="16">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr valign="bottom">
                        <td><smallfont>
                        $post[profile] $post[pmlink] $post[useremail] $post[homepage] $post[search] $post[buddy]
                        <!-- $ post[icqicon] --> <!-- $ post[aimicon] --> <!-- $ post[yahooicon] -->
                        </smallfont></td>
                        <td align="right" nowrap><smallfont>
                        <a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="{ imagesfolder }/edit.gif" border="0" alt="Edit/Delete Message"></a>
                        <a href="newreply.php?s=$session[sessionhash]&action=newreply&postid=$post[postid]"><img src="{ imagesfolder }/quote.gif" border="0" alt="Reply w/Quote"></a>
                        </smallfont></td>
                </tr>
                </table>
        </td>
</tr>
</table>
</DIV>


</td></tr></table>

<!-- spacer --></td><td width="10"><img width="10" height="1" src="{ imagesfolder }/space.gif" alt=""></td></tr></table>

The BLUE part is the old, traditional postbit --
this is what the post looks like when it's expanded.

The RED part is the newly added division -- this is
what the post looks like when it's contracted (shrunk).

Therefore, if you want an element to show in both situations - when
the post is expanded or contracted - that element must be placed in
BOTH divisions (the red and the blue).

For example, you can notice that in both the RED and the BLUE
divisions, I have placed $onlinestatus, $post[foldericon],
$post[postdate] and [b]$post[posttime] -- these elements will show
whether a post is extracted or contracted.

Therefore, likewise, if you have $post[postcount] in the BLUE
divisions (expanded post) and you also want it to appear in the
contracted post, then you need to place $post[postcount] in the RED
division -- wherever suits your design.

Hope this explanation helps.

Cheers,

Bira

p.s.

some people may have $countpost instead of $post[postcount], depending
on how you installed this hack. They are, however, the same.

Hooper 12-10-2001 12:09 PM

Someone must be trying to do what I am. Thanks for posting this information. Glad they asked for it. ;)

bira 12-10-2001 12:21 PM

[QUOTE]Originally posted by Baratator
greaaaaaaaaaaaaaaaaaaaaaat hack !!!!

jsut one thing... can you make it not srhink the fist post ?

I mean generally there is one post and a lot of replys and when you wiew it all the read replys are skunk but the riginal post too... the first one if you see what i mean...

thx this is a really useful hack !!

YoMama 12-10-2001 04:53 PM

Erm...

After installing this hack noone is able to register anymore. According to the vBulletin Database error email sent to me, the problem exists in register.php.

The email sez:
Code:

Database error in vBulletin 2.2.1:

Invalid SQL: INSERT INTO user (userid,username,password,email,styleid,parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invisible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts,startofweek,ipaddress,pmpopup,referrerid,nosessionhash,avatarid) VALUES (NULL,'Spankmaster C','9b1dd17445f20c234b44bccb0c611848','someemail@somedomain.com','1','','0','http://','','','','','1','0','0','Junior Member','1008002875','1','-1','1008002875','1008002875','3','+1','1','1','0','15','0000--','-1','2','213.84.221.150','1','0','1','0','0')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Monday 10th of December 2001 05:47:55 PM
Script: http://games.xs4all.nl/forums/forums/register.php
Referer: http://games.xs4all.nl/forums/register.php

I've added my register.php (zipped). I hope someone knows a quick fix for this, otherwise i'm... wel... in trouble ;-)

Regards,

Ronald

bira 12-10-2001 04:57 PM

hi Yomama,

Please don't post entire scripts.

I will post the correction for you, but I must know - what vBulletin version are you using?

Thanks.

bira 12-10-2001 05:03 PM

OK, open your register.php and go to line 444

Replace it with:

Code:

  $DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invisible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts,startofweek,ipaddress,pmpopup,referrerid,nosessionhash,avatarid,[high]hideposts[/high]) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes(md5($password))."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash','$avatarid','$hideposts')");
(I highlighted the bit that is missing).

Cheers,

Bira

YoMama 12-10-2001 05:21 PM

Bira,

Sorry for posting the entire script. I'm kind of a PHP newbie, and was unaware of forum rules.

Thanks a million for solving my problem... and thanks for the brilliant hack!

Regards,

Ronald

bira 12-10-2001 05:24 PM

YoMama, the problem was mine, not yours - it was a mistake in my installer :)

Anyways, glad it works for you and that you like it :)

Baratator 12-10-2001 06:44 PM

I've got te same problem with the new registrations...

and i added what you told me to add
but it always contract the fisrt post :(

bira 12-10-2001 06:59 PM

baratator,

Try adding, in admin/functions.php, the highlighted bit below:

Code:

// Contract Old Posts in Thread (v1.0)
        global $display, [high]$post[countpost],[/high] $HTTP_USER_AGENT;

        if ($post[dateline]>$bbuserinfo[lastvisit] and $post[countpost]=="0") {

See if this works. (cos it might be that $post[countpost] needs to be declared as global first).

Princeton 12-10-2001 07:27 PM

[QUOTE]Originally posted by bira
baratator,

Try adding, in admin/functions.php, the highlighted bit below:

Code:

// Contract Old Posts in Thread (v1.0)
        global $display, [high]$post[countpost],[/high] $HTTP_USER_AGENT;

        if ($post[dateline]>$bbuserinfo[lastvisit] and $post[countpost]=="0") {

See if this works. (cos it might be that $post[countpost] needs to be declared as global first).

Baratator 12-10-2001 09:03 PM

same problem, same error message
juste on coma :p


All times are GMT. The time now is 05:16 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.01786 seconds
  • Memory Usage 1,865KB
  • 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
  • (10)bbcode_code_printable
  • (3)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
  • (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