PDA

View Full Version : Poster of the day


Drowned
03-23-2003, 09:50 PM
I'm either blind or this hack doesn't exist. I bet it's very easy to make and lot's of people would use it. Instead of showing the top poster by it's total post, somebody could come up with a way for the top poster to be daily. Like TOP POSTER OF THE DAY. This way new users can become a top poster without having to catch up to older users. Something like this has to exist :devious:

Drowned
03-25-2003, 12:19 AM
No way :( It has to exist!

Lesane
03-25-2003, 11:12 AM
Open root/index.php and find:

// get total posts

Place after it:


// Top poster from last 24 hours
$hourslesane=time()-86400;
$gettopposter=$DB_site->query_first("SELECT DISTINCT(post.userid),COUNT(post.postid) AS posts,user.username FROM post LEFT JOIN user ON post.userid = user.userid WHERE post.userid > 0 AND post.dateline>=$hourslesane GROUP BY post.userid ORDER BY posts DESC LIMIT 1");
$topthisday="<smallfont><a href=\"member.php?action=getinfo&userid=$gettopposter[userid]\">$gettopposter[username]</a>: $gettopposter[posts] posts!";
// Top poster from last 24 hours


Save & Upload.

Then you can place this in the template: forumhome

Top Poster last 24 hours: $topthisday


That should work. 1 extra query on your main page though!

Boofo
03-25-2003, 11:19 AM
Just curious...can you do a left join and have only one query?

Lesane
03-25-2003, 11:38 AM
Today at 02:19 PM Boofo said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=372980#post372980)
Just curious...can you do a left join and have only one query?

Yes, you're right Boofo. I have reduced the query's into 1 query. :)

Boofo
03-25-2003, 11:56 AM
Thank you, sir. Every little bit helps. ;)

Drowned
03-26-2003, 12:24 AM
Wow thanks!!! :bowdown:

Drowned
03-26-2003, 03:26 AM
Ummm... there seems to be a problem... when the top user posts, it substracts post from $gettopposter instead of adding them... when I installed the hack the top poster had 116 posts, now he has 94 :S Everytime he posts, it displays one less :(

Boofo
03-26-2003, 04:51 AM
Try changing this:

DESC LIMIT 1

to this:

ASC LIMIT 1

Drowned
03-26-2003, 12:38 PM
Yesterday at 11:51 PM Boofo said this in Post #9 (https://vborg.vbsupport.ru/showthread.php?postid=373466#post373466)
Try changing this:

DESC LIMIT 1

to this:

ASC LIMIT 1


When I change that it just displays the poster with the least post in the last 24 hours :(

Crazy Pete
03-26-2003, 08:56 PM
It's because the query calculates the posts from 24hrs ago at that particular time, so for example if someone posted something at 3AM the day before, and it's now 4AM, that post wouldn't count in their top posters thing.

What I'd like to see is have this query run once every day at say midnight, and tally up the post counts from then and keep them cached, the run again the next day at midnight and so on. I'm trying to do this by integrating this code with Firefly's Member Of The Day hack but I can't quite get it to work correctly. Any ideas?

Drowned
03-26-2003, 11:14 PM
Today at 03:56 PM Crazy Pete said this in Post #11 (https://vborg.vbsupport.ru/showthread.php?postid=373787#post373787)
It's because the query calculates the posts from 24hrs ago at that particular time, so for example if someone posted something at 3AM the day before, and it's now 4AM, that post wouldn't count in their top posters thing.

What I'd like to see is have this query run once every day at say midnight, and tally up the post counts from then and keep them cached, the run again the next day at midnight and so on. I'm trying to do this by integrating this code with Firefly's Member Of The Day hack but I can't quite get it to work correctly. Any ideas?

That's EXACTLY what I was looking for and I came up with that conclusion about the hack this afternoon too :(

I guess I just explained it wrong... I bet somebody can come up with a fix for it in few mins :( If they could just read this thread, hehehe

g-force2k2
03-26-2003, 11:21 PM
i doubt thats the case...

since his post count is decreasing rather then increasing perhaps its because he isn't post 100+ per in the last day? i mean its sounds resonable to me and the coding looks sound...

besides twenty four hours is twenty four hours no matter where you live...

g-force2k2

Drowned
03-28-2003, 03:44 AM
:(