View Full Version : [RELEASE vB2.0] quick 'who posted'
Kier
Wed 7th Mar '01, 12:38pm
This is a fairly simple hack, but my users wanted it, so here it is.
What it does is to add a link to the number of replies for a thread, which allows users to quickly see who has posted in a thread without opening the showthread.php page. The results are shown in a small popup window.
Any suggestions or comments are welcome.
[edit: this hack is now included in vBulletin 2.0.3 and above]
PeF
Wed 7th Mar '01, 12:52pm
Another awesome release from Kier. Thanks again. :)
chrispadfield
Wed 7th Mar '01, 1:48pm
that is nice. Does it use any extra queries on forumdisplay or only when you click on the pop-up? I like it a lot.
Kier
Wed 7th Mar '01, 1:52pm
No extra queries on forumdisplay.php at all. :)
leadZERO
Wed 7th Mar '01, 6:42pm
Very nice.
I had some people asking for this, one less thing I have to write, thank you so much :)
Me2Be
Wed 7th Mar '01, 7:16pm
This is COOL!!!
conan
Wed 7th Mar '01, 7:38pm
Awesome another 5 star rating :)
conan
Wed 7th Mar '01, 8:04pm
I just installed the hack, and I have to say it was the easiest install I've ever did, the hack works great and it's pretty fast.
I think VBB's dev team ought be looking for someone like you Kier ;)
conan
Wed 7th Mar '01, 9:17pm
Originally posted by eva2000
yes i agree - installed it in less than 2 mins :)
works great hopefully it works in all netscape and IE browsers :D
I've tested on NN and no problems at all!
mrlister
Wed 7th Mar '01, 11:55pm
man you're just one awsome hacking machine. You just keep on coming and coming and each time they get better and better. :)
Shane
Thu 8th Mar '01, 10:05am
heh. Nice hack.. might have to install once our site is ready to move to vb 2.0 beta 2. *cough* Rat *cough* Well... there are other reasons for our delay, but.... it's cool. :D
Cold Steel
Thu 8th Mar '01, 2:13pm
Excellent hack.
Keep up the good work.
chrispadfield
Thu 8th Mar '01, 10:22pm
brilliant. Just installed it and it works perfectly. 5 Stars!
Craig A
Fri 9th Mar '01, 2:08pm
Cool! Many thanks for that - my users will appreciate it :)
jojo85
Sat 10th Mar '01, 10:32am
http://www.jeuxwebmasters.com/forums/forumdisplay.php?s=&forumid=19
Nice :)
chrispadfield
Fri 16th Mar '01, 1:36pm
one thing i was wondering, when you move a thread you get the "-" as the number of replies. With this hack it is no underlined because it still works but looks a little silly. Is there any way to not have this when the thread is moved. I would imagine not because you can't do and if elseif routine in the templates but just thought i would ask.
Kier
Fri 16th Mar '01, 1:52pm
It would be fairly easy to implement that, but as you pointed out, it would require a little condition to be placed in the php code, rather than a simple template change.
If you really want it, this is the code to modify:
Find in forumdisplay.php:
} else {
if ($foruminfo[allowratings]) { replace with
} else {
$thread[replycount] = "<a href=\"javascript:who($thread[threadid])\">$thread[replycount]</a>";
if ($foruminfo[allowratings]) { This code should be around line 390... but I can't give you an exact line number, as my forumdisplay.php doesn't really look much like the original ;)
You will also need to remove the hyperlink from the forumdisplaybit template.
Kier
Thu 22nd Mar '01, 12:49pm
Yep, open whoposted.php and select the whole SQL query, and replace it with this:
$posts = $DB_site->query("SELECT
COUNT(postid) AS posts, post.userid, user.username, subscribethread.userid AS subuserid
FROM post LEFT JOIN user USING (userid)
LEFT JOIN subscribethread ON
(subscribethread.threadid=post.threadid AND subscribethread.userid=user.userid)
WHERE post.threadid=\"$threadid\"
GROUP BY post.userid ORDER BY posts DESC"); then further down the code, find this:
eval("\$posters .= \"".gettemplate("whopostedbit")."\";"); and immediately above it, add this:
if ($post[userid]==$post[subuserid]) $subscribed = " <smallfont>[subscribed]</smallfont>";
else $subscribed = ""; then open your whopostedbit template and just after the closing </a> of the profile link, add $subscribed.
That oughta do it :)
eva2000
Thu 22nd Mar '01, 1:52pm
hmm it didn't work nothing no indicator of who subscribed showed up ?
Kier
Thu 22nd Mar '01, 7:28pm
oops... you should add $subscribed to your templates... not $subscribe. Sorry.
chrispadfield
Thu 22nd Mar '01, 8:50pm
thanks Kier for the change, will do it on next upgrade. cheers.
bira
Thu 22nd Mar '01, 11:11pm
great hack kier.
Just a couple of comments:
1. General comment to all: with regards to the $subscribed thingy, bear in mind that this is a serious invasion of privacy. And, unlike the "who is online", where you allow users to opt out, in adding this $subscrived thingy to the hack you are not allowing anyone any opt-out option.
2. Kier, I LOVE your hacks so please take my following comment as a constructive one: you do not follow strict php coding, which makes it immensely hard to debug a code that consists of your code and others.
Could you perhaps make sure you always use { and } for the ifs and elses? I think in a code made public, strict and global coding guidelines are imperative.
Anyhow, again, thanks for yet another great hack.
Cheers,
Bira
Freddie Bingham
Thu 22nd Mar '01, 11:45pm
2. Kier, I LOVE your hacks so please take my following comment as a constructive one: you do not follow strict php coding, which makes it immensely hard to debug a code that consists of your code and others.
Could you perhaps make sure you always use { and } for the ifs and elses? I think in a code made public, strict and global coding guidelines are imperative.
Bira there is no "strict php coding" rulebook that says one must enclose if/then segments withing curly braces. Without curly braces the compiler will only process the first following line for inclusion in the if/then. It is perfectly valid code.
i.e.
if ($x)
if ($y)
if ($z)
echo "YES";
is the same as and as valid as
if ($x) {
if ($y) {
if ($z) {
echo "YES";
}
}
}
Lordmusic
Fri 23rd Mar '01, 12:42am
This hack is great, but it has a flaw. When you do a search, say for the new posts, or any search for that matter, it does not have the hack in it. I am sure it's a simple bit of code editing but I am just toO damn lazy to look into it...
Lordmusic
Kier
Fri 23rd Mar '01, 12:44am
Originally posted by bira
unlike the "who is online", where you allow users to opt out, in adding this $subscrived thingy to the hack you are not allowing anyone any opt-out option. Okay, if you want to allow users to opt-out, we'll use the invisible setting, so that 'invisible' users don't have their subscriptions shown:
Replace the query with this:
$posts = $DB_site->query("SELECT
COUNT(postid) AS posts, post.userid, user.username, user.invisible subscribethread.userid AS subuserid
FROM post LEFT JOIN user USING (userid)
LEFT JOIN subscribethread ON
(subscribethread.threadid=post.threadid AND subscribethread.userid=user.userid)
WHERE post.threadid=\"$threadid\"
GROUP BY post.userid ORDER BY posts DESC"); then change the conditional code to this:
if ($post[userid]==$post[subuserid] && !$post[invisible]) $subscribed = " <smallfont>[subscribed]</smallfont>";
else $subscribed = ""; All done. Privacy restored.
make sure you always use { and } for the ifs and elses My new PM hack will be a model of strict coding.
Anyhow, again, thanks for yet another great hack.Welcome.
bira
Fri 23rd Mar '01, 12:44am
Freddie,
When I have your original code, plus someone else's hack, plus Kier, etc - if the style of coding is not unified, it makes it damn hard to debug if there's a mistake somewhere or a missing curly.
I am not saying this won't work - fact is it does - I am merely asking if possible that hackers restrict themselves to the same "full" (for lack of better word) coding.
Kier
Fri 23rd Mar '01, 1:47am
Originally posted by Lordmusic
This hack is great, but it has a flaw. When you do a search, say for the new posts, or any search for that matter, it does not have the hack in it. I am sure it's a simple bit of code editing but I am just toO damn lazy to look into it...
Lordmusic This would be a simple template edit.
claypots
Fri 23rd Mar '01, 2:37am
A great hack!
A couple of suggestions:
At the bottom of the pop-up box allow the user to click to go the actual thread and to close the window. [you can probably do these in a blink of an eye but I thgout I'd suggest it]
Again, great work!
Kier
Fri 23rd Mar '01, 3:08am
To do that, simply add this to your whoposted template:
<a href="javascript:opener.location=('showthread.php?s=$ses sion[sessionhash]&threadid=$threadid');">Go to this thread</a>
bira
Fri 23rd Mar '01, 3:26am
you can add self.close() to that javascript link, and the small window will close while the thread loads in the big window :)
claypots
Fri 23rd Mar '01, 4:18am
Thanks!
Kier
Fri 23rd Mar '01, 5:21am
Good idea bira :) For those who are not too familiar with javascript syntax, that would make the link look like this:
<a href="javascript:opener.location=('showthread.php?s=$ses sion[sessionhash]&threadid=$threadid'); self.close();">Show thread and close this window</a>
Lordmusic
Fri 23rd Mar '01, 5:39am
Just I am too dumb to know which one, please enlighten me...
tubedogg
Fri 23rd Mar '01, 2:15pm
Originally posted by freddie
Bira there is no "strict php coding" rulebook that says one must enclose if/then segments withing curly braces.
i.e.
if ($x)
if ($y)
if ($z)
echo "YES";
is the same as and as valid as
if ($x) {
if ($y) {
if ($z) {
echo "YES";
}
}
}
Not to mention the first makes your code shorter. :) Not to argue, bira, but I always use if ($whatever): instead of if ($whatever) { because I am forever forgetting to close the curly braces. So maybe I'm just lazy :) but I prefer to not use the braces.
CJ
Sun 25th Mar '01, 8:58am
good hack!
congrats
Mas*Mind
Sun 25th Mar '01, 9:12am
Originally posted by tubedogg
Not to mention the first makes your code shorter. :) Not to argue, bira, but I always use if ($whatever): instead of if ($whatever) { because I am forever forgetting to close the curly braces. So maybe I'm just lazy :) but I prefer to not use the braces.
Well, you do have to enclose it in brackets when an if block contains multiple statements...
offtopic:
I don't get why many people code like this:
if($this) {
doThis();
doThat();
if($that) {
bla()
}
}
else {
doThose();
doThese();
}
This way you easily forget those brackets to close, especially with nesting if's and else's...
It's far better to code like this:
if($this)
{ doThis();
doThat();
if($that)
{ bla();
}
}
else
{ doThose();
doThese();
}
When I go to the vb-code I often can't see what belongs to where...
bira
Sun 25th Mar '01, 9:38am
Originally posted by Mas*Mind
Well, you do have to enclose it in brackets when an if block contains multiple statements...
No, not in the alternative method he's talking about.
if you do if(whaterver): then you can have as many statements as you want, up until you write endif;
BUT, that method as well as my previous complaint just makes the code even more incomprehensible.
Mas*Mind
Sun 25th Mar '01, 9:42am
yeah, I noticed that...just quoted wrong :o
I wanted to quote on this
ira there is no "strict php coding" rulebook that says one must enclose if/then segments withing curly braces
bokhalifa
Tue 10th Apr '01, 4:17am
hi
Kier
not working
http://bokhalifa.org/daar/bo/whoposted.php
help me;)
bokhalifa
Tue 10th Apr '01, 5:48am
yea:D
Thanks!
eva2000;)
Lost
Tue 10th Apr '01, 5:49am
yeah since beta 4/4.1 it hasn't worked
So this hack will not work on beta 4??
Is that right????
Sorry to ask a dumb question....
tubedogg
Tue 10th Apr '01, 12:54pm
It works on my beta 4.1...
Raptor
Tue 10th Apr '01, 10:33pm
just installed on beta 5 - works like a charm !
TigerLily
Wed 11th Apr '01, 12:46am
Works on my copy of beta 5 too. Thanks, Kier!
Kim:)
TechTalk
Thu 12th Apr '01, 5:46pm
I like this because it is a standalone hack :) I wont add hacks that require editing of main files for sake of updating.
Thanks alot
~Chris
Mas*Mind
Sat 21st Apr '01, 8:41pm
One tiny bug....the post count is always one too many...
simple fix: replace $totalposts = number_format($totalposts); with $totalposts = number_format($totalposts)-1;
It bugs me why it is btw...Can't find anything wrong in the code...maybe $totalposts has to be initialized on zero first...but as far as I know that doesn't matter (didn't tested it though)
Mas*Mind
Sat 21st Apr '01, 9:36pm
DUH...
forgot that total replies isn't the same as total posts, to be exactly: The difference is one :D
Hooper
Sun 22nd Apr '01, 1:33pm
Great Hack. Works just fine.
Thank You Kier.
amsch
Thu 10th May '01, 10:10am
I just love it and it was easy to install for a php dummy like me!
Amy
jucs
Thu 24th May '01, 10:45pm
I got a file not found error in the popup.:(
Any ideas why?
In this template, there already is "topic Table" tag at the top. Do you put it above that or the script under it.
<!-- topic table -->
<script language="Javascript">
function who(threadid) {
window.open("whoposted.php?s=$session[sessionhash]&threadid="+threadid, "moo", "toolbar=no,scrollbars=yes,resizable=yes,width=200, height=300");
}
</script>
jucs
Fri 25th May '01, 4:52pm
See my other post. I just need to know the answer to the question. And, why it would not be working. I followed directions to the letter too. :(
Update..duh me. The darn whoposted.php file got uploaded as whoposted_php. :rolleyes:
express
Sat 26th May '01, 1:36am
Great Hack Thanks
http://www.realwebhost.net
Joey
Thomas P
Sat 2nd Jun '01, 2:08pm
amazing hack!
thanks kier,
-Tom
WEAPON
Sun 3rd Jun '01, 5:43pm
Great hack. Works perfectly.
AnnaFan
Mon 4th Jun '01, 9:21am
Hi,
under replies I found this:
0normalfont>
What is wrong? I think the normalfont tag is wrong. But I canīt find the error. Can somebody help me please?
version2
Fri 8th Jun '01, 5:23pm
I am trying to get this to work. I dont know exactly what went wrong, but when you click on the thread[replycount] link it pops up a box with template info. Its not parsing it.
Trying to figure it out..any ideas?
Here is a link:
http://www.mysticwicks.com/whoposted.php?threadid=2937
c-prompt
Sat 9th Jun '01, 2:27pm
On yours how did you get it to change cell color for each post. Or, I should say using 2 colors that alternate. The script as written only uses 1 color for both cells.
Thanks
TWTCommish
Sat 9th Jun '01, 2:37pm
It requires some mild hacking. Find the while() loop used to display the threads in forumdisplay.php, and add this before it:
$alt_num = 1;
Then, right inside the loop, add something like this:
$alt_color = ($alt_num % 2 == 0) ? "#FFFFFF" : "#E9E9E9";
$alt_num++;
Then just reference $alt_color instead of "{firstaltcolor}", etc, in your forumdisplay_bit template. I did it with my forums here: http://forums.thestands.com
mister
Tue 12th Jun '01, 4:44am
easy install, awesome feature.
5-star.
thanks kier.
version2
Thu 14th Jun '01, 1:26am
Originally posted by version2
I am trying to get this to work. I dont know exactly what went wrong, but when you click on the thread[replycount] link it pops up a box with template info. Its not parsing it.
Trying to figure it out..any ideas?
Here is a link:
http://www.mysticwicks.com/whoposted.php?threadid=2937
Anyone?
RobAC
Thu 14th Jun '01, 1:38am
If you do a view source on this page, these are the warning messages you find embedded near the top:
<b>Warning</b>: Cannot add header information - headers already sent by (output started at /home/version2/public_html/whoposted.php:4) in <b>/home/version2/public_html/admin/functions.php</b> on line <b>1187</b><br>
<br>
<b>Warning</b>: Cannot add header information - headers already sent by (output started at /home/version2/public_html/whoposted.php:4) in <b>/home/version2/public_html/admin/functions.php</b> on line <b>1187</b><br>
express
Wed 27th Jun '01, 11:12am
This is a great hack. Is there a way to add this to a forum on the total post column?
Joey
heynurse
Fri 29th Jun '01, 1:33am
kier.... u da man!
great hack! Very useful. 5 - *****'s
MarkB
Fri 29th Jun '01, 2:55am
I installed this but had to remove it as whoposted.php, when opened from the thread list, showed nothing but the source code - and I am sure I've followed every step of the installation correctly. Does anyone have any ideas? :(
version2
Fri 13th Jul '01, 11:35am
Originally posted by MarkB
I installed this but had to remove it as whoposted.php, when opened from the thread list, showed nothing but the source code - and I am sure I've followed every step of the installation correctly. Does anyone have any ideas? :(
I have the same problem...and I still never figured it out.
version2
Fri 13th Jul '01, 11:40am
Originally posted by RobAC
If you do a view source on this page, these are the warning messages you find embedded near the top:
<b>Warning</b>: Cannot add header information - headers already sent by (output started at /home/version2/public_html/whoposted.php:4) in <b>/home/version2/public_html/admin/functions.php</b> on line <b>1187</b><br>
<br>
<b>Warning</b>: Cannot add header information - headers already sent by (output started at /home/version2/public_html/whoposted.php:4) in <b>/home/version2/public_html/admin/functions.php</b> on line <b>1187</b><br>
Rob, sorry for being a bit clueless here. But, I have no idea what that is supposed to mean. :p
Kier
Wed 1st Aug '01, 4:15am
This hack is now included in vBulletin 2.0.3
Powered by vBulletin™ Version 4.0.0 Beta 4 Copyright © 2009 vBulletin Solutions, Inc. All rights