vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Poster of the day (https://vborg.vbsupport.ru/showthread.php?t=50733)

Drowned 03-23-2003 09:50 PM

Poster of the day
 
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:

PHP Code:

// 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
PHP Code:

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

Quote:

Today at 02:19 PM Boofo said this in Post #4
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:

PHP Code:

DESC LIMIT 1 

to this:

PHP Code:

ASC LIMIT 1 


Drowned 03-26-2003 12:38 PM

Quote:

Yesterday at 11:51 PM Boofo said this in Post #9
Try changing this:

PHP Code:

DESC LIMIT 1 

to this:

PHP Code:

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

Quote:

Today at 03:56 PM Crazy Pete said this in Post #11
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

:(


All times are GMT. The time now is 07:09 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01087 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete