View Full Version : "Who Posted" Enhancement: View All Posts By User In This Thread
Hi all,
Don't know if there will be much interest here, but my users asked for this so I wrote a hack.
What is it?
When you click on the total replies in vBulletin, you can see a list of all posters who participated in the thread, and how many posts each had in that thread.
The hack adds a link to this pop-up window -- allowing you to view all posts by User X in that thread.
Where can I see a Demo?
I'm probably explaining it badly, so here's a demonstration:
Go to my bulletin board, at http://www.atlasf1.com/bb/index.php
Visit any one of the forums and click on the # of replies for any one of the threads (select one with lots of posts for better demonstration).
Click on the # of posts next to a username in the "Who Posted"
pop-up window
The result: you will get a page looking and behaving exactly like showthread for that thread, however it will include ONLY posts by that specific poster.
You can reply to the thread, quote a post, everything as if you were in the full thread.
You can also jump directly to the location of a specific post, by clicking on the post count to the right side of the post (you need to have Post Count (https://vborg.vbsupport.ru/showthread.php?s=&threadid=22083) hack installed for this).
How do I install it?
With almost no work at all.
Download the attachment - showposts.txt - and rename it to showposts.php. Upload it to your forums' main directory.
Edit template whopostedbit and replace
$post[posts]
with
<a href="showposts.php?s=$session[sessionhash]&threadid=$threadid&postuserid=$post[userid]" target="_blank">$post[posts]</a>
That's it :)
Cheers,
Bira
Forgot to say this has been tested and works on 2.03 and up, including the latest version (2.2.1)
Lesane
11-28-2001, 07:04 PM
Nice Hack Bira, Thanks
Very cool! Thanks, Bira! :D
itstd
11-28-2001, 10:05 PM
Pretty cool! A lot of times the mems on my forum are only interested in what a Mod replys to their question (especially a technical one) and this is perfect for that. Thanks!
Martz
11-28-2001, 11:29 PM
Fantastic, I love these hacks with no file editing, just tweak a template and your away :)
Great work bria. :D
Hooper
11-29-2001, 05:27 AM
Very nice. Works super. Thank you.
Admin
11-29-2001, 01:18 PM
I like it, and I'm gonna install it (sometime ;)), but I have something to say.
Why do you need a whole new file just for getting X's posts?
Right now you have this, right?
$getpostids=$DB_site->query("
SELECT post.postid FROM post
WHERE post.threadid='$threadid' AND post.visible=1
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");
(in showthread.php)
You can just change it to something like:
$getpostids=$DB_site->query("
SELECT post.postid FROM post
WHERE post.threadid='$threadid' ".iif(isset($postuserid), "AND post.userid='$postuserid'", "")." AND post.visible=1
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");
And that's it! :)
(unless I'm missing something you had special in showposts.php)
Just constructive criticism. :):)
FireFly you must have the same checks or this file will become a way for users to look at hidden threads, for example.
I stripped off what clearly isn't needed (like go to next/last thread, like go to newest post, etc).
But you still have to make the same "work" as you would for showthread:
check in which order to show the posts - newest first or oldest first?
check whether the thread is visible
get permissions
do the posts-per-page routine
draw the navbar
bbcode et. al.
page nav
admin options or not
In short, you treat it almost exactly like you'd treat a thread. Well, it IS a thread. Just only one poster's messages in it :)
Admin
11-29-2001, 02:33 PM
[QUOTE]Originally posted by bira
FireFly you must have the same checks or this file will become a way for users to look at hidden threads, for example.
I stripped off what clearly isn't needed (like go to next/last thread, like go to newest post, etc).
But you still have to make the same "work" as you would for showthread:
[...]
In short, you treat it almost exactly like you'd treat a thread. Well, it IS a thread. Just only one poster's messages in it :)
oh, I see what you mean, sorry! ahahaha, sorry - I completely misunderstood you :)
That's nifty - I didn't think of doing what you did :blush:
I can only see one small change, really, but that can be overcome easily, so I'll edit the first post now and post the new lean version of the hack :D
Thanks
Admin
11-29-2001, 02:48 PM
... or has Kaizen would say, "the penny has dropped for you". :p
[QUOTE]Originally posted by bira
I can only see one small change, really, but that can be overcome easily, so I'll edit the first post now and post the new lean version of the hack :D
Actually I prefer it in a separate file, FireFly - less calls and code parsing. There's no need to parse the entire showthread.php code for this function, hence I'd rather separate them and be more economic.
If, however, you prefer to only edit showthread.php, then what you did is not enough. Do the following:
1) Find
if ($goto=="nextnewest") {
And change it to:
if (($goto=="nextnewest") && (!isset($postuserid))) {
2) Find
if ($goto=="nextoldest") {
And change it to:
if (($goto=="nextoldest") && (!isset($postuserid))) {
3) Find
// draw nav bar
$navbar=makenavbar($threadid,"thread",0);
And change it to:
// draw nav bar
if (isset($postuserid)) {
$navbar=makenavbar($threadid,"thread",1);
} else {
$navbar=makenavbar($threadid,"thread",0);
}
4) Find
if ($thread[pollid]) {
And change it to:
if (($thread[pollid]) && (!isset($postuserid))) {
5) Find
$postscount=$DB_site->query_first("SELECT COUNT(*) AS posts FROM post WHERE post.threadid='$threadid' AND post.visible=1");
And change it to:
$postscount=$DB_site->query_first("SELECT COUNT(*) AS posts FROM post WHERE post.threadid='$threadid' ".iif(isset($postuserid), "AND post.userid='$postuserid'", "")." AND post.visible=1");
6) Find
$getpostids=$DB_site->query("
SELECT post.postid FROM post
WHERE post.threadid='$threadid' AND post.visible=1
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");
And change it to (this is the change you already made):
$getpostids=$DB_site->query("
SELECT post.postid FROM post
WHERE post.threadid='$threadid' ".iif(isset($postuserid), "AND post.userid='$postuserid'", "")." AND post.visible=1
ORDER BY dateline $postorder LIMIT ".($limitlower-1).",$perpage
");
7) Find
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage");
And change it to
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid".iif(isset($postuserid), "&postuserid=$postuserid", "")."&perpage=$perpage");
These are the changes I could pick up off the top of my head. Personally I prefer to separate the two, so as not to add more procedures to showthread, and at the same time to deduct unnecessary procedures from showposts
Cheers,
Bira
Admin
11-29-2001, 04:26 PM
Thanks bira for letting me know. :)
I actually only did the 3rd, 5th, 6th and 7th changes you listed, the others are really minor and not worth it. :)
Oh, and you have one ." too many here, and also something else: :)
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage".iif(isset($postuserid), "&post.userid='$postuserid", "").");
redid that line for clarity's sake :)
Admin
11-29-2001, 04:42 PM
You forgot to remove the dot between post and userid in that line. ;)
Sorry for being petty. :)
argh, bloody hell, heh. I'm not focused today, think I'll go have dinner and watch telly. Shouldn't be messing with code in my state :D
Martz
11-29-2001, 10:49 PM
A seperate file is very appealing, ease of installation and bug hunting, less rehacking to do before an upgrade and if all hacks were *somehow* made this way we could keep our support for unedited files. Just a thought, as they say.
What are the disadvantages of using many files?
[QUOTE]Originally posted by Martz
What are the disadvantages of using many files?
Hooper
11-30-2001, 12:45 AM
I can see Chen's point of view, but I agree with above. I really like the idea of having the code in one file. It was easy to install and in the event of chasing down a "bug". (not that Bira would ever post code with a bug :D ), It is much easier to chase down. I'll stick with the original scheme.
Again Thank you Bira. Viewing all posts by one person is really nice. ;)
I must admit that personally I'd prefer a separate file whenever possible, if only because I don't need to rehack my scripts every time we upgrade.
like vblinks - I've had that hack for almost a year now, and not once did I have to worry about it when I upgraded - it has entirely different files.
So when appropriate or possible, I'd always prefer a separate file to hacking original code.
Hooper
11-30-2001, 12:56 AM
Yuppers. I have enough hacking going on! :D
Lionel
12-25-2001, 10:43 PM
I have the same problem with Lesane's hack top thread starter... if the user who started is not registered, all non guests will increment to show all as the first non guest. :stupid:
Hi Lionel,
Wish I could help you but I never had guests posting on my BB, so I don't know at all how the BB behaves with guests posting :/
Sorry. Hope someone else will know better than me :o
Bira
Lionel
12-25-2001, 10:59 PM
I posted in vb.com I think it is from them....
Lionel
12-26-2001, 01:58 AM
I was told that vbulletin gives all guests the same user id -0
eva2000
01-11-2002, 06:38 AM
i added this awesome hack :)
would it be possible to add an extra mod/admin option on the showpost.php page to allow mods/admin to mass move/split those listed posts by a particular member to another destination forum ???
eva2000
01-11-2002, 06:39 AM
[QUOTE]Originally posted by bira
I must admit that personally I'd prefer a separate file whenever possible, if only because I don't need to rehack my scripts every time we upgrade.
like vblinks - I've had that hack for almost a year now, and not once did I have to worry about it when I upgraded - it has entirely different files.
So when appropriate or possible, I'd always prefer a separate file to hacking original code.
kidney
03-10-2002, 07:00 PM
I get an error.
Parse error: parse error in /Library/WebServer/Documents/dishwacker/forum/whothreads.php(23) : eval()'d code on line 27
This only happens on the forums home page
Mark Hewitt
03-11-2002, 09:18 AM
Can this be made to work with your minimise unread posts hack. (The one thats installed on this forum).
As it stands it will show the thread with only that persons posts in it. I'd rather it showed the posts by that user maximised but everyone elses minimised. Thus then you have the option to take a look at what other posters are saying.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.