Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

"Soft" locking old/stale topics

Started by dada78641, January 27, 2023, 04:19:08 PM

Previous topic - Next topic


Hi everyone. I'm currently working on setting up an SMF 2.0.19 forum with a custom theme.

I've been interested in locking older topics to ensure people can't necropost in them and bring them back to the forefront. Like, say, all topics that haven't received new replies in over 6 months.

Getting all stale topics is simple and automatically locking them is easy too, but I kind of want to display them differently than "regular" locked topics that a moderator manually decided to lock. I also would like to show a message saying something like "This topic hasn't received replies in the past n months so you can't reply".

So my question is, how would you store the information about these topics? I don't mind making a separate table for it, storing the information in there, and then requesting it every time a list of topics is being displayed, but maybe there's a more "proper" way to do this? Is there some kind of metadata storage for custom purposes?

Appreciate any thoughts on this :)

edit: just to clarify, my thinking is: I'll lock the topics, but also add the ids to a separate store so that I know to visually display their locked status a bit differently than normal locked topics. But other than that they behave like real locked topics. At least that's my idea.

Diego Andrés

SMF Tricks - Free & Premium Responsive Themes for SMF.


Quote from: Diego Andrés on January 27, 2023, 04:27:31 PMDid you try with this mod:
I've seen that there are a number of mods that auto lock topics, but I want something a little bit different in terms of how it looks to viewers. Like, I'd prefer it if 90% of the forum isn't just lock icons, basically. :)

Just auto locking posts by itself isn't very hard as far as I can tell. But from what I can tell I don't think there's a mod that does exactly what I described in my post?

Which is fine, I'm OK to build it by myself. I'm just wondering how I would store the data. But I guess probably I just need to make my own table for this?

Thanks for your thoughts

Doug Heffernan

Quote from: dada78641 on January 27, 2023, 04:19:08 PMHi everyone. I'm currently working on setting up an SMF 2.0.19 forum with a custom theme.

May I ask why you are not using 2.1.3.?


Quote from: Doug Heffernan on January 27, 2023, 06:06:23 PM
Quote from: dada78641 on January 27, 2023, 04:19:08 PMHi everyone. I'm currently working on setting up an SMF 2.0.19 forum with a custom theme.

May I ask why you are not using 2.1.3.?

The main reason is that I'm converting a very old forum, and we have an old theme that I'm remaking which was built around an older SMF theme. So it seemed more natural to base the work on the 2.0.19 default theme. 2.0.19 is definitely old and not the cutting edge but it didn't look so old to me that it seemed like a terrible idea (although of course I'm not sure!) The converter I found also only goes to 2.0 and it's buggy to boot (I'll have to dig deep and do some fixes..), so for now I decided to just roll with this instead of trying to figure out the 2.1 branch.

I do think eventually I'll make a project of upgrading to the 2.1 branch. Is what I'm trying to achieve easier on that, or is there some kind of provision in the 2.1 branch for doing things similar to this?


2.0.x is near end of life.
There is a good chance that it will not be updated again,  and know that php 8.2 breaks it.

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."


If you're doing custom work, it definitely makes more sense to do it based on SMF 2.1. Once you have successfully converted your existing forum to SMF 2.0, just run the Large Upgrade package for SMF 2.1 to get up to date.

You will also find it easier and cleaner to create a custom modification to do what you want for SMF 2.1. You can simply use the existing integration hooks to disable replies on topics over a certain age.

You would probably be most interested in the integrate_display_buttons hook in Display.php (so that the reply option is removed when viewing a topic), and the integrate_post_end and integrate_post2_start hooks in Post.php, in order to head off anyone attempting to post by manually entering URL parameters.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.


Thanks, I'll definitely make a project of upgrading once we get things up and running. Right now we're getting pretty close to having it all working and our old forum is actually falling apart, so I'll probably do it a bit later, but I do definitely see the point in doing so! Especially since it seems it's much easier to do things like this in 2.1.