Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Auto lock a topic?

Aloittaja Cybex, huhtikuu 21, 2004, 05:52:57 AP

« edellinen - seuraava »

Cybex

Is it possible to auto-lock a topic when nobody replies to that topic for 20 days orso?


Tyris

at the moment: No!
however I was personally considering doing a mod for it... maybe when things cool of at uni i will...
the biggest problem is the actual chore of locking the topics after a certain amount of time.. but I'd figured out a reasonably quick way of doing it...
I dont spend much time at these forums anymore, but this topic caught my eye ;)
so dont expect me to read many if any replies ;) (if you get no other positive replies maybe message me)...
after this monday I'll maybe see what I can do ;)

Saleh

this mod can be easily done !!
I am just waiting for the final/stable release of SM 1.0 and I will start working on light mods like this one ..

We don't need a reason to help people

Cybex

Okay, let's hope the stable will be released soon then :) Thanks in advance Nevermind.

dschwab9

Lainaus käyttäjältä: Tyris - huhtikuu 21, 2004, 06:33:15 AP
the biggest problem is the actual chore of locking the topics after a certain amount of time

Crontab is your friend  ;D  You just need a script that runs daily, hourly, or at whatever interval you want

Tyris

hmm... what is crontab -_-;; and does it work on windows machines? (obviously it would run daily)

[Unknown]

There's a windows port... basically it is like "Task Scheduler" but more powerful and lightweight.

-[Unknown]

Tyris

aa, ok, cool ^_^
but will this work with a default php + mySQL install? or does it need addons?

klaus3

Sorry to resurect an old topic, but I have search on this and found nothing.

Is now-a-days any mod available to auto-lock a topic based on age?

SaikoJosh

Can I just ask why lock old topics? Allowing people to reply to older topics reduces spam.

Digital Home Central - Products for the 21st century home (under construction).

Prasad007

how do you use cron tabs? what are the commands for it?

kegobeer

"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Prasad007


H

Anyone know the query to auto-lock non-sticky topics that haven't had a reply in six months?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

klaus3

huwnet: that's what I was was looking for. Even crappy phpbb has a mod to do that...

SaikoJosh

You could just write a few lines of PHP to do this, saves working out complex queries.

The topic table has the ID of the last message posted so it's easy to find out the date of the last message. If it is over 6 months ago run another query to lock that topic.

Digital Home Central - Products for the 21st century home (under construction).

H

Lainaus käyttäjältä: jcoleuk - helmikuu 05, 2006, 09:26:00 AP
You could just write a few lines of PHP to do this, saves working out complex queries.

The topic table has the ID of the last message posted so it's easy to find out the date of the last message. If it is over 6 months ago run another query to lock that topic.

This is exactly what I am looking for. I would rather not have a bulky mod that adds to the admin centre and may not get updated.

Anyone volunteer to write the code / query?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

klaus3

Something like this might work:

TOPIC=1

for TOPIC=1 to count(ID_TOPIC) {

LASTMSG= SELECT smf_topics.ID_LAST_MSG from smf_topics where smf_topics.ID_TOPIC=TOPIC

LASTMSGTime = SELECT smf_messages.posterTime from smf_messages where smf_messages.ID_MSG=LASTMSG

If (LASTMSGTime-now>6 month) set ID_TOPIC.locked = 1

ID_TOPIC=ID_TOPIC+1

}


run on cron? or everytime someone visits the page?

PHP pro needed thought.  8)

H

Running as a cron would be better for server performance
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Advertisement: