PDA

View Full Version : Top Posters per Forum (shown in forumdisplay)


Gary King
07-31-2003, 10:00 PM
What does this hack do?

This hack shows the top poster in each forum, in the forumdisplay template (so when viewing the forum, you can see the top poster for that forum).

The line that displays the top poster for the forum is in the template, so you can move it anywhere you want it to show up! :)

Modifications

show highest posters from last 24 hours (https://vborg.vbsupport.ru/showpost.php?p=450614&postcount=44) link member usernames to their profiles (https://vborg.vbsupport.ru/showpost.php?p=450614&postcount=44)

Change Log

version 1.1

enables you to specify how many top posters you want to have displayed per forum adds commas in between usernames in the top posters list

Screenshots
forumdisplay v1.1 (https://vborg.vbsupport.ru/showpost.php?s=&postid=422733)
forumdisplay v1.0 (https://vborg.vbsupport.ru/showpost.php?s=&postid=422404)

Enjoy!

Gary King
08-01-2003, 03:44 PM
Screenshot of forumdisplay

assassingod
08-01-2003, 03:51 PM
If I had a forum i'd use this. Nice work:)

FleaBag
08-01-2003, 04:44 PM
Nice work. Installing it on www.dragonninja.co.uk - thanks! :)

psico
08-01-2003, 05:22 PM
WARNING!!

Do not install this if you have a LARGE forum...this query is very intensive...

See ya.

jdmuniverse
08-01-2003, 06:12 PM
Wow, thanks for the tip!

Gary King
08-01-2003, 06:27 PM
Today at 02:22 PM psico said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=422426#post422426)
WARNING!!

Do not install this if you have a LARGE forum...this query is very intensive...

See ya.

But, do you have any proof of it having such an intensive impact on large boards? Screenshot maybe, with this hack installed and uninstalled?

What about comparing this query to the queries used in the search page, or the memberlist? Eh? This isn't as intensive as those are; it's just a straight-forward query that lists all the users who have posted in the forum :)

TonTon
08-01-2003, 07:46 PM
im getting This forum's top poster is with posts! but with no name. I have tried to install it twice both with the same result. In forumdisplay i have 3 different eval("dooutput(\"".gettemplate('forumdisplay')."\");");. I only used it on the 1 maybe thats my mistake

Gary King
08-01-2003, 09:56 PM
3 different ones? The stock vBulletin forumdisplay.php only has 1 :rolleyes:

Anyways, you should place the code before the final eval("dooutput(\"".gettemplate('forumdisplay')."\");"); of forumdisplay.php

PiotrasG
08-02-2003, 12:17 AM
i get the same no name

karmanis
08-02-2003, 02:01 AM
Thank you very much Gary! (karmanis clicks Install )

However, to make this hack a must, I would suggest you make 2 modifications...


1) Make visible the 10 most active members instead of only the first. (Such a thing will be in coherence with the title of the hack, "top posterS")

This would extend the functionality of the hack, and make it act as a whole information block instead of a simple line. Furthermore, it is more tempting if 10 users could see their name, rather than have just one been satisfied. ;)



2) Modify the query to get the posters from not only the current forum but from the forum and its childforums .


The last one is going to solve the problem stated by TonTon, which also happens to me and is caused because if you are currently at a category and not at a forum, the query does not find any posts in the category so it can not find any posters to show. ;)

Making the query to get the posts from all the childforums, the hack will be able to show the top posters like a charm.



Thanks again,
this is going to be a hack in great demand here at vb.org !

Gary King
08-02-2003, 02:03 AM
v1.1 coming right up!

Ryan Ashbrook
08-02-2003, 09:50 PM
Very nice hack, however, I have had members change their names from what they originally registered with, and your hack shows their very first name.

How can I fix this?

Gary King
08-03-2003, 12:47 AM
Well, my hack pulls the usernames from the user table, so unless you've changed things so that your users' usernames aren't from that table anymore, then you'll have to modify the hack accordingly.

Gary King
08-03-2003, 12:58 AM
Top Posters per Forum v1.1 is now out!

New features include:

enables you to specify how many top posters you want to have displayed per forum adds commas in between usernames in the top posters list

Stay tooned for other updates and announcements!

Dean C
08-03-2003, 10:07 AM
Would this work faster with an index on the post table ;)

karmanis
08-03-2003, 12:24 PM
...Where is the attachment for version 1.1 ?
Does this retrieve the posters counting also the posts inside subforums ???

thanx
:)

LadyBeth
08-03-2003, 12:45 PM
Can this be modified so that the Administrator is not included?
THanks!
Beth

Gary King
08-03-2003, 01:14 PM
Today at 09:24 AM karmanis said this in Post #17 (https://vborg.vbsupport.ru/showthread.php?postid=422826#post422826)
...Where is the attachment for version 1.1 ?
Does this retrieve the posters counting also the posts inside subforums ???

thanx
:)

In the first post of this thread. If you don't get it, then try clearing your cache :)

Gary King
08-03-2003, 01:24 PM
Today at 09:45 AM LadyBeth said this in Post #18 (https://vborg.vbsupport.ru/showthread.php?postid=422829#post422829)
Can this be modified so that the Administrator is not included?
THanks!
Beth

Replace the // Top Posters Per Forum hack v1.0 by Gary W.
$topposter=$DB_site->query("SELECT COUNT(post.postid) AS posts,userid,username FROM post
LEFT JOIN thread ON post.threadid = thread.threadid
LEFT JOIN forum ON forum.forumid = thread.forumid
WHERE forum.forumid=$forumid
GROUP BY userid ORDER BY posts DESC LIMIT 0,$topposterno");


with // Top Posters Per Forum hack v1.0 by Gary W.
$topposter=$DB_site->query("SELECT COUNT(post.postid) AS posts,post.userid,post.username FROM post
LEFT JOIN thread ON post.threadid = thread.threadid
LEFT JOIN forum ON forum.forumid = thread.forumid
LEFT JOIN user ON user.userid = post.userid
WHERE forum.forumid=$forumid AND user.usergroupid != 6
GROUP BY userid ORDER BY posts DESC LIMIT 0,$topposterno");

Gary King
08-03-2003, 01:37 PM
Today at 07:07 AM Mist said this in Post #16 (https://vborg.vbsupport.ru/showthread.php?postid=422809#post422809)
Would this work faster with an index on the post table ;)

For the post.username column? Yes, I added that to the instructions as an optional step, for people with larger boards :)

Arabs Emperor
08-06-2003, 11:27 PM
it not worked it come for me error

Gary King
08-06-2003, 11:33 PM
Today at 08:27 PM Arabs Emperor said this in Post #22 (https://vborg.vbsupport.ru/showthread.php?postid=423960#post423960)
it not worked it come for me error

What error do you get?

Heffe2000
08-09-2003, 04:59 AM
I've tried this on my main forums, and my test forums. Both give me the same result:

Database error in vBulletin 2.3.0:

Invalid SQL: SELECT COUNT(post.postid) AS posts,userid,username FROM post
LEFT JOIN thread ON post.threadid = thread.threadid
LEFT JOIN forum ON forum.forumid = thread.forumid
WHERE forum.forumid=2
GROUP BY userid ORDER BY posts DESC LIMIT 0,
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5

mysql error number: 1064

Date: Saturday 09th of August 2003 01:56:17 AM
Script: http://forums.galaxies-online.com/forum/forum/forumdisplay.php?forumid=2
Referer: http://forums.galaxies-online.com/forum/index.php?s=

Gary King
08-09-2003, 12:53 PM
You didn't run the SQL query at the end of the instructions.

lifesourcerec
08-10-2003, 11:28 PM
I ran it and got the same error. And did run both queries.

Gary King
08-11-2003, 12:23 AM
Today at 08:28 PM lifesourcerec said this in Post #26 (https://vborg.vbsupport.ru/showthread.php?postid=425016#post425016)
I ran it and got the same error. And did run both queries.

Try going to vBulletin Options and hitting submit ;)

Heffe2000
08-13-2003, 06:59 PM
Actually I did run the last query, on both systems. I'll try it again on my test system and see if I possibly missed a step, but I ran through it twice already.

Gary King
08-13-2003, 07:59 PM
08-10-03 at 09:23 PM Gary W said this in Post #27 (https://vborg.vbsupport.ru/showthread.php?postid=425044#post425044)
Try going to vBulletin Options and hitting submit ;)

psico
08-18-2003, 03:45 AM
I ran this query:

ALTER TABLE post ADD INDEX (username);

But it still hanging up my server...
My POST table has 400mb almost a million of posts, it is impossible to run a COUNT() query without hanging up everything...

engquist
08-21-2003, 06:16 PM
I am running Vbulletin 2.3.0 and had the exact same issue as Heffe2000 described above....however, after I went to VBulletin options and click submit as suggested, it got rid of the database error. You may want to somehow update the directions for this problem. Thanks for the solution though!

One small problem, it lists most of the top posters correctly, but it leaves some names completely out.

For example:

This forum's top 5 posters are: meru+rikku=anoying with 24 posts , Star F. Apacolypse with 18 posts , Phantom Warheart with 14 posts , Firebrand Delacroix with 9 posts , and with 8 posts!

but notice it doesn't say who did the 8 posts!

here's another of my forums:

This forum's top 5 posters are: Dark Firebrand with 20 posts , with 17 posts , with 9 posts , Epyon with 7 posts , and Star F. Apacolypse with 4 posts!

I think that the user named "Warrior of Light" has the 17 posts, and another named Sun2mid has the 9 here.....but I can't figure out why those usernames aren't showing up...

Gary King
08-21-2003, 08:06 PM
I am running Vbulletin 2.3.0 and had the exact same issue as Heffe2000 described above....however, after I went to VBulletin options and click submit as suggested, it got rid of the database error. You may want to somehow update the directions for this problem.

Yep, I just added it now :)

Arabs Emperor
08-26-2003, 08:21 PM
i get error
this
+_+++++++++++++++++++++
Database error in vBulletin 2.3.0:

Invalid SQL: SELECT COUNT(post.postid) AS posts,userid,username FROM post
LEFT JOIN thread ON post.threadid = thread.threadid
LEFT JOIN forum ON forum.forumid = thread.forumid
WHERE forum.forumid=14
GROUP BY userid ORDER BY posts DESC LIMIT 0,
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5

mysql error number: 1064

Date: Tuesday 26th of August 2003 05:26:09 PM
Script: http://www.arabse.net/forums/forums/forumdisplay.php?forumid=14
Referer:

++++++++++++++++++++++
i do every thing

Arabs Emperor
08-26-2003, 08:31 PM
it work good when i submet VB option
thanks

Gary King
08-27-2003, 12:04 AM
Please click on the install button as well, thanks ;)

Silver740
09-05-2003, 07:56 PM
08-10-03 at 08:23 PM Gary W said this in Post #27 (https://vborg.vbsupport.ru/showthread.php?postid=425044#post425044)
Try going to vBulletin Options and hitting submit ;)


What do you mean by "Go to VBulletin Options and Hit Submit"?

What does this do? Where is this button? I only see a "Save Changes" button and a "Reset" button on the bottom

Gary King
09-05-2003, 08:43 PM
Today at 04:56 PM Silver740 said this in Post #36 (https://vborg.vbsupport.ru/showthread.php?postid=431599#post431599)
What do you mean by "Go to VBulletin Options and Hit Submit"?

What does this do? Where is this button? I only see a "Save Changes" button and a "Reset" button on the bottom

Then hit the Save Changes button ;)

Red Blaze
10-11-2003, 08:19 PM
Then hit the Save Changes button ;)


LMAO, that was too obviouse.

Anywho, this is kinda what I want, BUT, is there a way to show the user's Avatar?

Gary King
10-11-2003, 08:23 PM
LMAO, that was too obviouse.

Anywho, this is kinda what I want, BUT, is there a way to show the user's Avatar?
Well, it wouldn't be a problem, but why would you want to show their avatars? It would take up a lot of space, in most cases anyways.

Red Blaze
10-11-2003, 09:02 PM
Well I just wanted it as a little add on for my forum. I wouldn't mind at all.

dgtlchlk
11-14-2003, 10:38 AM
I've installed this hack, and got no errors back but it only displays this "This forum's top posters are:", no number of top posters or the top posters. Any clues as to why?

Gary King
11-14-2003, 11:12 AM
I've installed this hack, and got no errors back but it only displays this "This forum's top posters are:", no number of top posters or the top posters. Any clues as to why?
Are you viewing a forum, and not a category?

dave777
12-03-2003, 10:27 PM
Great hack.... :)

Is there anyway to make it count only the previous 24 hours? (top 10 posters for the day)

dave777
12-05-2003, 07:11 AM
Great hack.... :)

Is there anyway to make it count only the previous 24 hours? (top 10 posters for the day)
Nevermind, I worked out how to do this myself....

I simply added the following to forumdisplay.php:
$datecut=time()-(86400);

and then added "AND post.dateline>=$datecut" to the "where" line, like so:
WHERE forum.forumid=$forumid AND post.dateline>=$datecut

and it worked like a charm.

I also added this to the topposters template so the usernames were linked to their profiles:
<a href="member.php?s=$session[sessionhash]&amp;action=getinfo&amp;userid=$top[userid]">
(closed with a </a> after $top[username])

Gary King
12-06-2003, 01:06 AM
Nevermind, I worked out how to do this myself....

I simply added the following to forumdisplay.php:
$datecut=time()-(86400);

and then added "AND post.dateline>=$datecut" to the "where" line, like so:
WHERE forum.forumid=$forumid AND post.dateline>=$datecut

and it worked like a charm.

I also added this to the topposters template so the usernames were linked to their profiles:
<a href="member.php?s=$session[sessionhash]&amp;action=getinfo&amp;userid=$top[userid]">
(closed with a </a> after $top[username])
Glad to see some people modifying my hack to their board's liking ;)

lifesourcerec
06-06-2004, 03:05 PM
Will this be available for VB3?

Gary King
06-06-2004, 11:44 PM
Will this be available for VB3?
You get what you ask for :p
https://vborg.vbsupport.ru/showthread.php?p=520021#post520021