PDA

View Full Version : View All Attachments in Thread


TWTCommish
03-21-2002, 10:00 PM
This hack is simple and pretty easy to install.

What's it do?
Ya' know that little paperclip icon you see next to thread links containing attachments? Well, this hack makes that icon clickable. Clicking on it will give you the normal thread view and page navigation and all that, except you'll only see the posts with attachments in them. I find this particularly useful if you have a few threads where, say, members post their pictures. It's nice to cut through a lot of the comments and get straight to the files.


What's it involve?
7 code changes in 2 files. No template work of any sort.


Got a demo?
Surely: Demo...yay (http://www.movieforums.net/showthread.php?threadid=1315&view=attachments).


The attached instructions.txt file will walk you through things. Enjoy; and let me know if you find any bugs, as I haven't tested this on any board but my own yet.

Jawelin
03-22-2002, 10:45 PM
Very useful !!!
I'll use ASAP.... but FireFly, please install it here too so everybody could get rid of those long and rich-of-attachments thread in this hack forum !

Thanks a lot

Admin
03-23-2002, 07:20 AM
Excellent idea Chris. :) Will install this right away...

Admin
03-23-2002, 07:25 AM
Works great, good job.

Jawelin
03-23-2002, 08:41 AM
Very very useful...

Just a NON-problem, better a constatation, with another hack:
when I use the 'attach' ikon and only posts with attachments are displayed, post shown are numbered (Post #X hack) in a relative way, of course... I.e. they don't refer to the original post sequence in thread.
As said, just a point out...
;)

Thanks again, to both (now!)

TWTCommish
03-23-2002, 01:15 PM
Oh, do you mean with the post counter/direct link hack? Hmmm, I haven't looked at that one in any sort of significant detail...but I imagine, to keep their original numbers and such, I'd have to either give up the page navigation the way it is (so that it'd refer to the original thread including non-attachment posts), or I'd have to stick another query in there somewhere. I'm not sure.

Anyway, glad you like it, guys. :) I remember thinking of it and then wondering why I hadn't before. Hand it to my members, though, for asking for an easy way to access the attachments. :)

Jawelin
03-23-2002, 01:20 PM
Of course.... I was first liked this hack ! ;)
Just a think I noticed... that's all.
Thanks

TWTCommish
04-07-2002, 01:04 PM
Small update to this: the original hack doesn't turn the paperclip image on the search results page into a clickable link the way it does for the one on the forumdisplay. This is easily corrected. Find this around line 970-something in you search.php file:

$paperclip="<img src=\"{*imagesfolder*}/paperclip.gif\" alt=\"$searchresult[attach] Attachment(s)\" border=\"0\">";
...and replace it with this...
$paperclip="<a href=\"showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]&view=attachments\"><img src=\"{*imagesfolder*}/paperclip.gif\" width=\"10\" height=\"13\" alt=\"$searchresult[attach] Attachment(s)\" border=\"0\" align=\"absmiddle\"></a>";
That should do it. :) Take the asterisks out, however, from the {*imagesfolder*} part -- I had to add them in there, or this forum would process them as vB.org's image folder location.

skyline2002
04-08-2002, 04:52 AM
how can make this hack work with v2.01.

i couldnt find the code below (in showtheard.php):
-------------------------------------------------
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage");
----------------------------------------------------

Admin
04-08-2002, 12:52 PM
If I were I would forget about this hack and upgrade to 2.2.5 ASAP. I don't know how to say this so you will listen, this is very important and 2.0.1 is highly exploitable.

sybaxi
04-25-2002, 03:33 AM
I can't seem to install this. Does it works with 2.2.5 ? Cos i can't seem to find that line to replace with. This is installed in this forums though, and it's running 2.2.5. And oh, i tried installing leaving the last bit out. Everything is fine but when i clicked on the paperclip it displays the whole thread itself, not just the attachments.
Please help. Thanks alot.


$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage");

Replace it with this:


if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage$attachment_querystring");

Save and upload.

Tarion
06-03-2002, 02:19 AM
I had the same Problem only when i have installed FireFlys Number of Hacks Hack, without this hack it does work but with it the hole thread is displayed not only the messages with attachments, pleas help

TWTCommish
06-03-2002, 03:10 AM
Well, look at FireFly's hack and see if it changes that line. If it does, follow the modified instructions accordingly. :)

Tarion
06-03-2002, 10:09 AM
i do follow FireFlys instructions, but your $attachment_clause has no effect.

This are FireFlys line:

$getpostids=$DB_site->query("
SELECT post.postid,post.userid AS postuserid FROM post
WHERE post.threadid='$threadid' AND post.visible=1
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");


and this is my line:

$getpostids=$DB_site->query("
SELECT post.postid,post.userid AS postuserid FROM post
WHERE post.threadid='$threadid' AND post.visible=1$attachment_clause
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");

TWTCommish
06-03-2002, 12:26 PM
You're talking about different things. First, you were talking about another block of code, and now this one. Which is the problem? I don't see what it is you're saying.

Tarion
06-03-2002, 02:38 PM
sorry TWT for my bad explaining.

Wath I mean is, wenn i install Fireflys Hack the above namde blocks are effekted by changes of both Hacks, but wenn i do Fireflys instructions and then yours (and the $attachment_clouse behinde the post.visibile) it doesn't work it alway shows up the complet Thread nut only the attachment messages, i tried to do it by my self but it doesn't work.

Sorry also for my bad english i don't often speak or write in english (i'am german :) )

I hope you know an answer

TWTCommish
06-03-2002, 02:46 PM
Can you give me the link to FireFly's hack?

Boofo
06-03-2002, 03:30 PM
In your instructions you said to replace this line of code:
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage");

With this:
if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage$attachment_querystring");


The code I found was:
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display".iif(isset($highlight), "&highlight=$highlight", ""));


Here's what I did, will it work ok?
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display".iif(isset($highlight), "&highlight=$highlight", "$attachment_querystring"));

Tarion
06-03-2002, 03:34 PM
here ist the Link to Firefly's hack: https://vborg.vbsupport.ru/showthread.php?s=&threadid=33811

THX for help

TWTCommish
06-03-2002, 03:34 PM
No, I don't think so. I'm not sure, but I think this ought to work, though:

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display$attachment_querystring".iif(isset($highlight), "&highlight=$highlight"));

Tarion
06-03-2002, 03:36 PM
Originally posted by Boofo
In your instructions you said to replace this line of code:
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage");

With this:
if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage$attachment_querystring");


The code I found was:
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display".iif(isset($highlight), "&highlight=$highlight", ""));


Here's what I did, will it work ok?
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display".iif(isset($highlight), "&highlight=$highlight", "$attachment_querystring"));


no

put it after this

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&$attachment_querystring&display=$display".iif(isset($highlight), "&highlight=$highlight"));

Boofo
06-03-2002, 03:47 PM
Here's what I have for that piece of code right now.
if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display".iif(isset($highlight), "&highlight=$highlight", "$attachment_querystring"));


What should it actually be? :)

TWTCommish
06-03-2002, 03:49 PM
It should be this, I think:

if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display$attachment_querystring".iif(isset($highlight), "&highlight=$highlight", ""));

Boofo
06-03-2002, 03:55 PM
Tarion? You agree? I just want to make sure on this. If you don't agree, can you tell me why, please?

Boofo
06-03-2002, 04:00 PM
TWTCommish ,

How did you put the attachment box in the message and what is the hack for who downloaded it? And, lastly, how did you put the link in the box under the attachment? I'd like to try it, if I can. :)

Martin64
06-05-2002, 10:29 PM
Excellent job. Works like a charm. :D

Smoothie
06-07-2002, 05:32 PM
Yes, installed. Marvelous!

Boofo
06-07-2002, 08:22 PM
This must have been the right way to do it because it works great! :) thanks for all of your help and an excellent hack! :)

Originally posted by TWTCommish
It should be this, I think:

if ($view == 'attachments') {
$attachment_querystring = '&view=attachments';
} else {
$attachment_querystring = '';
}

$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage&display=$display$attachment_querystring".iif(isset($highlight), "&highlight=$highlight", ""));