Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 07-15-2004, 09:57 PM
LBoogie LBoogie is offline
 
Join Date: Jan 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Reply request....

I got a hack request for anyone.


I been searching for a way to limit the ammount of replies to a thread. Example:

For only specified forum id such as 5 , 7 ,18 and 30

When a user is posting a thread there is an extra field called "Max replies".

They can fill it in and put a number between 1 - 50.

They post thier thread. And the first whatever users replied can reply but after the limit is reached it displays a message stating maximum replies have been reached for this thread.

An example of how this would work would be somthing like this.

I'm on my board and i just made a song for all my fans. I put the song as a hidden link in my post and ask that users reply. (Already have a hide hack installed) The first let's say 20 people who reply get to download my song. But after that all other users will get a message of "your too late!"

Anyone help me with this?

I found some old 2.x code on this site that might help....

Code:
if(in_array($threadinfo[forumid],array(13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58,  59 ))) { 
$posts=$DB_site->query_first("SELECT COUNT(*) AS replies FROM post LEFT JOIN thread USING (threadid) WHERE post.userid=$bbuserinfo[userid] AND thread.forumid IN (13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58,  59 ) AND post.dateline > ".(time()-3600)); 
if($posts[replies]>=10) show_nopermission(); 


}


Thanks alot!
Reply With Quote
  #2  
Old 07-15-2004, 10:08 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so basically close a thread after X replies?
Reply With Quote
  #3  
Old 07-15-2004, 10:15 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this (ported from the above code, untested, but theoretically it should work):

PHP Code:
if (in_array($threadinfo[forumid],array(13171920262733344445515258,  59 ))) { 
  
$posts $DB_site->query_first("SELECT COUNT(*) AS replies FROM post LEFT JOIN thread USING (threadid) WHERE post.userid=$bbuserinfo[userid] AND thread.forumid IN (13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58,  59 ) AND post.dateline > ".(time()-3600)); 
  if (
$posts[replies]>=10print_no_permission(); 

If the time doesn't matter you can also avoid the query:

PHP Code:
if (in_array($threadinfo[forumid],array(13171920262733344445515258,  59 )) and $threadinfo['replycount'] > 10) { 
  
print_no_permission();

Reply With Quote
  #4  
Old 07-15-2004, 10:20 PM
Killahbyte Killahbyte is offline
 
Join Date: Jun 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AN-net
so basically close a thread after X replies?


More or less....Summed up short yes that's what i want....


(sorry different username....)
Reply With Quote
  #5  
Old 07-15-2004, 10:21 PM
Killahbyte Killahbyte is offline
 
Join Date: Jun 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Try this (ported from the above code, untested, but theoretically it should work):

PHP Code:
if (in_array($threadinfo[forumid],array(13171920262733344445515258,  59 ))) { 
  
$posts $DB_site->query_first("SELECT COUNT(*) AS replies FROM post LEFT JOIN thread USING (threadid) WHERE post.userid=$bbuserinfo[userid] AND thread.forumid IN (13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58,  59 ) AND post.dateline > ".(time()-3600)); 
  if (
$posts[replies]>=10print_no_permission(); 

If the time doesn't matter you can also avoid the query:

PHP Code:
if (in_array($threadinfo[forumid],array(13171920262733344445515258,  59 )) and $threadinfo['replycount'] > 10) { 
  
print_no_permission();



This will stop the posts at 10 but for some reason it does 10 posts per person....

KB
Reply With Quote
  #6  
Old 07-15-2004, 10:25 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erm ... yep.

If you want x posts/user you will need the query.

But from you first post I thought you wanted a general x posts limit, therefore I included the 2nd snippet.
Reply With Quote
  #7  
Old 07-15-2004, 10:25 PM
Killahbyte Killahbyte is offline
 
Join Date: Jun 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Killahbyte
This will stop the posts at 10 but for some reason it does 10 posts per person....

KB


Not to mention the code above is set for a certain time limit....
Reply With Quote
  #8  
Old 07-15-2004, 10:27 PM
nexialys
Guest
 
Posts: n/a
Default

i don't see why users themselves would have the control on how many replies they want for any thread... admin option is already possible with this hack:
https://vborg.vbsupport.ru/showthread.php?t=60059

this is per-forum based so you can set each forum to have a limit of replies per thread... this is basically what you search for i think...
Reply With Quote
  #9  
Old 07-15-2004, 10:28 PM
Killahbyte Killahbyte is offline
 
Join Date: Jun 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Erm ... yep.

If you want x posts/user you will need the query.

But from you first post I thought you wanted a general x posts limit, therefore I included the 2nd snippet.

Ok let me try that.....Last question is how hard is it to add the box for the newthread.php. To let the users specify how many replies there are allowed
Reply With Quote
  #10  
Old 07-15-2004, 10:30 PM
Killahbyte Killahbyte is offline
 
Join Date: Jun 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that just may work thanks alot....
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05315 seconds
  • Memory Usage 2,267KB
  • 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
  • (1)bbcode_code
  • (4)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete