• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Preventing old thread bumping

Ingenious

Well-known member
#1
What are my options for preventing necroposting (bumping old threads), but without locking them all?

I was expecting to find plenty of add-ons to do this but can't find any, unless I missed them.

Basically a removal of the reply option if the last reply was > x days old, with exceptions for some usergroups like admin.

There's an add-on which runs on a cron and locks threads over a certain date but I don't want to do it that way.
 

Ingenious

Well-known member
#3
I did see that Optic and didn't want just a warning, but having read the discussion thread on it, I see a member has come up with a way of modifying the template to stop any replies. Also, I can probably write a warning that's so stern it might work anyway. So thanks for the suggestion I'll give it a go.
 

Ingenious

Well-known member
#4
OK that didn't really work out. It puts quite an annoying warning at the bottom of the reply box on every old thread. I'd prefer just to remove the option to reply for old threads, maybe with a small "no permissions" style line of text.

Any other suggestions?
 

Optic

Well-known member
#5
@Ingenious, I think maybe you can use a date based conditional around the Submit button.

Relevant template should be thread_reply:
Code:
<dl class="ctrlUnit submitUnit">
        <dt></dt>
        <dd>
            <input type="submit" value="{xen:phrase reply_to_thread}" accesskey="s" class="button primary" />
            <input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" />
        </dd>
    </dl>
So something along the lines of a conditional:
IF date of post is NOT older than 30 days, THEN display Submit button: (untested)

Code:
<xen:if is="!({xen:calc '{$serverTime} - 2592000'} > {$thread.last_post_date})">
            <input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" />
</xen:if>
(Have to use seconds due to PHP using Unix timestamp)

Sorry that's the best I can think of - a developer can probably advise a more elegant solution. :p
 

Ingenious

Well-known member
#6
Thanks, I'll look into that. If the conditional works I should be able to wrap it around the reply box to remove it for certain usergroups.