Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2002, 05:35 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default A simple hack that YOU can help me with.

I have looked all over and it can't be found, but it's pretty simple. All I want is a hack that will count the number of threads in the forums id's I specify for the last 24 hours. But, it has to be able to work on a non-vb page. I don't think this would be that hard, but it would really come in handy. I don't want the final number to be seperate numbers, I want it to add all the new threads in the certain forums together to make a final number. Again, 1 single number of all the new threads created in the forums that I specify and it will reset to zero when the 24 hours is up, and it needs to work on a non-vb page.

It would be nice if I could adjust the time of the 24 hour reset though, but is not nessasary for me to still use the hack.

Please can somebody help me with this?

Thanks for any help or redirection you can offer.
Reply With Quote
  #2  
Old 04-13-2002, 06:41 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

something like:

PHP Code:
<?
require("/path/to/forums/global.php");
$last24 = time() - 86400;
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE lastpost > $last24 AND (forumid = 'FORUMID1' OR forumid = 'FORUMID2')"));
echo $threads[total];
?>
that SHOULD work, but i'm no expert and i didn't test this code so...
Reply With Quote
  #3  
Old 04-13-2002, 07:15 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Listen...

If he says it works, trust him...

He found a way to stop admins editing my profile, so for that I thank him tremendously...

Satan
Reply With Quote
  #4  
Old 04-13-2002, 08:22 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, so if I want to add more forums to the hack so that adds them to the total would I just add

forumid = '12'

to the end of the line where you say:

forumid = 'FORUMID1' and forumid = 'FORUMID2'?

And how do I change the time for the hack?

BTW thanks for such a fast reply.

EDIT: I test it and it was off, it was only saying 32 and it should of either been over 100 or 0, depending on where the 24 hours mark lies.

I changed the "OR"s to "AND"s and it just stays 0 even when a new thread is created.

Can you please help?
Reply With Quote
  #5  
Old 04-14-2002, 03:08 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

first, the OR needs to stay "OR".

second, you are correct in changing the "FORUMID1" and "FORUMID2" parts (and you can add more with the same syntax).

third (and i might have misunderstood), what this script does is counts how many threads were posted to in the past 24 hours in the forums you specify.

fourth, the 86400 part is the number of seconds in 24 hours. if you want to change the 24 hours, just do 3600 times the number of hours you desire and replace 86400 with the result.

if i misunderstood what you're looking for, let me know
Reply With Quote
  #6  
Old 04-15-2002, 04:43 AM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope, still isn't working.

I have all my forum set and it still says there have been 6 posts in the last 24 hours.

And when does the 24 hours start? If you are doing it in seconds, when does it start over? That's what I was asking. I want to change when it started, because for what I am using it for I don't want the 24 hour period to restart right when I am posting my stuff that I want it to track. Right now I need it to start and end at 4:00 AM MDT

I double checked that all the forums I want included in it for the hack to track are in the hack and there id's are correct and it all checks out, so it must be something with the hack.

Any ideas?
Reply With Quote
  #7  
Old 04-15-2002, 06:06 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My forums are down so this I'm kind of guessing here, but would this work? If you want this on your main page, put this in you index.php, I don't THINK it matters where, but I could be wrong.

PHP Code:
$thisdate date('Y-m-d');
$getthreadtotal $DB_site->query_first("SELECT COUNT(*) as total FROM thread WHERE dateline = $thisdate AND forumid = 'FORUMID1' OR forumid = 'FORUMID2'");
$threadtotal $getthreads[total];

eval(
"\$threadtotal = \"".gettemplate('forumhome')."\";"); 
Then put $threadtotal somewhere in your forumhome template.
Reply With Quote
  #8  
Old 04-15-2002, 06:27 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mr e I need this to work on a none vb page and I don't exactly know how to change that code so that it would work.

The date in that code looks like it's static. It looks like if I put in a date that it will always be that date, it wont change. So the first day I used it it would show the last 24 hours, but the next day it would show 48 and so on and so forth. I need something that will only show the latest posts since the last 24 hours and I need to be able to change when the 24 hour period restarts. I don't nessasarly want it to be the 12:00 of the server, or whatnot.

More help please.
Reply With Quote
  #9  
Old 04-15-2002, 09:33 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not a static time because everytime you load the page it checkes the date('Y-m-d'); so today it would equal 2002-05-15 and tomorrow it would equal 2002-05-16. Got it? I'll try to see if I can figure out how to get this on a non-vB page.
Reply With Quote
  #10  
Old 04-15-2002, 09:43 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by mr e
It's not a static time because everytime you load the page it checkes the date('Y-m-d'); so today it would equal 2002-05-15 and tomorrow it would equal 2002-05-16. Got it? I'll try to see if I can figure out how to get this on a non-vB page.
So what happens if the threads that I am trying to track, somebody comes to the page for the first time in the middle of the chunk of posts that I am trying to track? I don't want it to say 50 posts today and tomorrow it has the other 50, when it should really be reading 100.

How does it track it?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:13 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.06311 seconds
  • Memory Usage 2,260KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete