TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:33:38 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 77
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 64
  • Total: 64

max replies per topic

Started by resurgence, July 15, 2005, 02:12:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

resurgence

is there anyway to add this to SMF?

i would like to restrict topic size to around 500-600 posts per topic and then it get automatically locked.

to be more specific, i would rather have it happen by board. but the above is fine.

is there a way to do this? :)

thanks in advance.

*sits waiting for neptune_tp* ;)


IchBin

This is definately something you should ask at the SMF forums.

Bjørn

Most likely it will be a mod.

But..maybe, if Post.php have info on how many replies the thread has, the Post.template could choose to NOT show the posting screen, just a message saying "topic is full" or something. No messing with the database.

I will check.

Bjørn


resurgence

cool :)

how do i do that? and is there a way to make the topic auto lock?

Bjørn

Locking is harder..but to do what I meant...maybe change Display.template  - and Post.template too - to NOT show reply/quote button and quick-reply when number of replies goes over a set value. (That could be in current theme settings). Instead it will show a small note above the post "This thread have over x posts, and cannot be replied too" for example. Sam thing in Post.tempalte, just in case someone tries a "action=post" link even if the thread has no button. ;) It could also be only for non-admins.

resurgence

well, i guess that's perfectly fine :)

how do i do that?

Bjørn

#7
Open up Display.template first..then insert this right after the "global $context, $settings, $option..." line:
        // check if topic is over x number of replies, admin CAN reply regardless
        $max_replies=2;

        if($context['num_replies']>$max_replies && !$context['user']['is_admin']){
            $context['can_reply']=false;
        }


Then the same spot in Post.template.php, just in case someone does a manual link:
        // check if topic is over x number of replies, admin CAN reply regardless
        $max_replies=2;

        if($context['num_replies']>$max_replies && !$context['user']['is_admin']){
            fatal_error('This topic has reached its maximum number of replies.');
        }


This should take away reply,quote and quick-reply unless you are an admin, and give a error if someone does a manual link instead. That way you will have those attempts in your error log too.

I have just made number of replies a very small number - 2 - to test things. Change them to your liking in both places.

resurgence

thanks bloc!!

is it right though? the global $context, $settings, $option.. line appears 2x in display.template and 3x in post.template

:)

Bjørn

the top one in all of them. :)