PDA

View Full Version : Reply request....


LBoogie
07-15-2004, 09:57 PM
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....



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!

AN-net
07-15-2004, 10:08 PM
so basically close a thread after X replies?

Andreas
07-15-2004, 10:15 PM
Try this (ported from the above code, untested, but theoretically it should work):


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) print_no_permission();
}


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


if (in_array($threadinfo[forumid],array(13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58, 59 )) and $threadinfo['replycount'] > 10) {
print_no_permission();
}

Killahbyte
07-15-2004, 10:20 PM
so basically close a thread after X replies?



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


(sorry different username....)

Killahbyte
07-15-2004, 10:21 PM
Try this (ported from the above code, untested, but theoretically it should work):


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) print_no_permission();
}


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


if (in_array($threadinfo[forumid],array(13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58, 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

Andreas
07-15-2004, 10:25 PM
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.

Killahbyte
07-15-2004, 10:25 PM
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....

nexialys
07-15-2004, 10:27 PM
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...

Killahbyte
07-15-2004, 10:28 PM
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 :)

Killahbyte
07-15-2004, 10:30 PM
that just may work thanks alot....