phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Automatic Lock Topics (with no replies) after a certain time

Goto page 1, 2  Next
 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Sep 23, 2009 7:51 pm 
Post subject: Automatic Lock Topics (with no replies) after a certain time

Hi, I am searching for a Mod that Automatically Lock Topics (with no replies) after a certain time.

Does such a Mod exist?

/Holger
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Wed Sep 23, 2009 10:51 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

Holger wrote:

Does such a Mod exist?

Yes.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Thu Sep 24, 2009 6:26 am 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

Really? icon_biggrin.gif
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Thu Sep 24, 2009 7:32 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

I believe so, and if it doesn't, then I'll write the code for you.
_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Thu Sep 24, 2009 8:11 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

I have not found anything at phpbbhacks.com and phpbb.com
Difficult words to search with also ... many results.
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Thu Sep 24, 2009 8:57 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

I believe this is what you are looking for: Auto Lock Hack.
_________________
phpBB2 will never die, I hope!
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Fri Sep 25, 2009 12:02 am 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

dogs and things wrote:
I believe this is what you are looking for: Auto Lock Hack.

Quote:
May not be ideal for large sites.


What I was going to do was write the code into the viewtopic.php, something like:
Code:
if($board_config['auto_lock_topics'] && $topic['last_post_time'] < (time() - $board_config['auto_lock_topics_time']))
{
     $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_status = ' . TOPIC_LOCKED . ' WHERE topic_id = ' . $topic_id;
      if(!$db->sql_query($sql))
      {
             message_die(GENERAL_ERROR, 'Could not auto lock topic', '', __LINE__, __FILE__, $sql);
       }
}


The problem is that the topic's last post time is not so easy to get. In phpBB 3, it' stored in the topics table for each topic; in v2, you have to query the posts table to get the time. icon_neutral.gif

It looks like the problem with the Auto Lock Mod is that it attempts to periodically lock ALL topics which haven't been replied to in awhile, rather than just locking the topic when it is accessed. The latter method is the best way to go, IMO, as long as you can solve the problem of getting last post time.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 663
Location: Texas


flag
PostPosted: Fri Sep 25, 2009 4:45 am 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

Getting the last post time is as simple as getting post_time from phpbb_posts where post_id = topic_last_post_id

The appropriate way to do this would be with a cron job, not with code inside of phpBB. Else you might find someone starting to reply to a topic that wasn't locked, only to have it lock in the middle of his/her reply. Not very user friendly.

_________________
phpBBDoctor Blog
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Fri Sep 25, 2009 6:37 am 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

drathbun wrote:
Else you might find someone starting to reply to a topic that wasn't locked, only to have it lock in the middle of his/her reply. Not very user friendly.

Nah, that wont happen, because I would only lock three months old topics without answer.
But yeah, I have no problem running a Cron doing this!

Dog Cow, I would happily test any code you think may work.

I will also try the hack above.
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Fri Sep 25, 2009 7:11 am 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

I tried the Auto Lock MOD above ...
Timeout when entering that forum.
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Fri Sep 25, 2009 4:23 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

drathbun wrote:
Getting the last post time is as simple as getting post_time from phpbb_posts where post_id = topic_last_post_id
Yeah, but I didn't want to have to run that extra query, since it would have to be done on every topic view if one were to go the route I had suggested.

Quote:
The appropriate way to do this would be with a cron job, not with code inside of phpBB. Else you might find someone starting to reply to a topic that wasn't locked, only to have it lock in the middle of his/her reply. Not very user friendly.
How would a cron job solve that problem? What if I'm replying to a topic which the job has just locked? IMO, the best solution to this problem is just not to worry about it. It could happen even if a moderator were to lock a topic just as someone was typing a reply.

Using a cron job solves one problem, but introduces another, and that is the fact that every unlocked topic must be queried, and its last post time fetched.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 663
Location: Texas


flag
PostPosted: Fri Sep 25, 2009 6:42 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

The risk of having someone reply to a in-the-process topic is minimized with a cron job. First, you have to tag the code somewhere if it's in the php code. Do you check when someone views the topic? Or when they start to reply? How do you time that? I was commenting based on the assumption that it would work like the pruning process. There is a check for prune jobs every time an admin or moderator views a forum. You could do the lock job then, or you could do it everytime anyone views a topic. That's a lot of extra queries.

With a cron job you can at least start at 2am or some time when the board activity is very low. Plus every topic is checked once a day, not every time someone views a topic or forum.

_________________
phpBBDoctor Blog
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Sun Sep 27, 2009 7:32 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

drathbun wrote:

With a cron job you can at least start at 2am or some time when the board activity is very low. Plus every topic is checked once a day, not every time someone views a topic or forum.

You've got a point there.

With phpBB 2, the best way to go is probably by cron. In phpBB 3 with its de-normalized schema, then you could either way.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
hoimyr
Board Member



Joined: 16 Apr 2009

Posts: 115
Location: Oslo


flag
PostPosted: Wed Oct 07, 2009 2:02 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

I installed the auto lock hack some years ago but i removed it because my users didnt like it and some wanted to continue on their topics. But is it easy to adopt some of the code and make a warning-banner pop-up in the top of the topic if its old? "Warning! This is an old topic!" I see phpbb3 has a banner thingy here in the topic with info link Think that one shows it on all topics in that category but if it had used a time setting it could be a very nice feature. icon_smile.gif
Back to top
Holger
Board Member



Joined: 19 Jan 2009

Posts: 509
Location: Hanover


flag
PostPosted: Wed Oct 07, 2009 2:03 pm 
Post subject: Re: Automatic Lock Topics (with no replies) after a certain

hoimyr wrote:
I installed the auto lock hack some years ago but i removed it because my users didnt like it and some wanted to continue on their topics.

I just want it for topics without replies maybe after 6 months ... after that time NOBODY wants to continue anything icon_biggrin.gif
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 2 All times are GMT
Goto page 1, 2  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0440 seconds using 15 queries. (SQL 0.0139 Parse 0.0011 Other 0.0290)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo