Auto lock topic

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
ban_zai™
Registered User
Posts: 17
Joined: Mon Dec 12, 2005 4:59 pm
Location: Singapore

Auto lock topic

Post by ban_zai™ »

Hi,

I am wondering if there is a mod to auto lock a topic on a set number of days/months posted?
Let's say i want a topic to be lock after 30 days of no reply, is it possible?

Thanks in advance.
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK

Re: Auto lock topic

Post by karlsemple »

Mod requests should be posted in the mod request forum which is where I am going to move this.
Image
mcK
Registered User
Posts: 23
Joined: Wed Dec 12, 2007 10:22 am

Re: Auto lock topic

Post by mcK »

I hope someone does this
stokerpiller
Registered User
Posts: 1934
Joined: Wed Feb 28, 2007 8:06 pm

Re: Auto lock topic

Post by stokerpiller »

I would like this too.
I had it on my phpbb2 forum and it was GREAT :D
I am done with phpBB
User avatar
SuperMaurim®
Registered User
Posts: 12
Joined: Thu Aug 07, 2008 1:28 pm

Re: Auto lock topic

Post by SuperMaurim® »

Do I need this much for MOD phpbb3. I found only for phpbb2. Someone could adapt it for me, please?
User avatar
SuperMaurim®
Registered User
Posts: 12
Joined: Thu Aug 07, 2008 1:28 pm

Re: Auto lock topic

Post by SuperMaurim® »

anybody would help me? I need much this MOD.
User avatar
SuperMaurim®
Registered User
Posts: 12
Joined: Thu Aug 07, 2008 1:28 pm

Re: Auto lock topic

Post by SuperMaurim® »

Please. Help me !!!

nobody would help me?

I need this MOD for phpbb3.
Shining Phoenix
Registered User
Posts: 27
Joined: Wed Feb 28, 2007 8:15 am

Re: Auto lock topic

Post by Shining Phoenix »

*bump*

Every so often a newbie comes in and starts beating a dozen dead horses, so this mod would make moderating much easier.
Midwinter
Registered User
Posts: 1
Joined: Tue Oct 07, 2008 9:18 am

Re: Auto lock topic

Post by Midwinter »

I hope this isn't a dead horse yet. I hope this mod gets made. It would stimulate new discussions without having to erase old content.
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run

Re: Auto lock topic

Post by A_Jelly_Doughnut »

This is fairly easy to accomplish, code-wise. I'll try to get something put together :)
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28855
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Re: Auto lock topic

Post by Paul »

A_Jelly_Doughnut wrote:This is fairly easy to accomplish, code-wise. I'll try to get something put together :)
I actually have this nearly finished already for someone else, I will be publising this later this week.
Vampire1812
Registered User
Posts: 31
Joined: Fri Sep 12, 2008 1:04 pm

Re: Auto lock topic

Post by Vampire1812 »

Sorry to necro the thread but did this get done?
9moska3
Registered User
Posts: 21
Joined: Sun Nov 16, 2008 12:00 am

Re: Auto lock topic

Post by 9moska3 »

Paul wrote:
A_Jelly_Doughnut wrote:This is fairly easy to accomplish, code-wise. I'll try to get something put together :)
I actually have this nearly finished already for someone else, I will be publising this later this week.
So?
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: Auto lock topic

Post by mtrs »

I tried a short code for this, moderators and posters above 100 post counts are not affected, topic last post time checked and NORMAL_TOPICS locked upon reply/quote attempts.
I updated the code
http://www.phpbb.com/community/viewtopi ... #p10895205
Last edited by mtrs on Sat Jan 23, 2010 10:14 pm, edited 6 times in total.
I abandoned all of my mods.
User avatar
damsprivate
Registered User
Posts: 461
Joined: Sun Aug 17, 2008 10:39 pm
Location: indonesia

Re: Auto lock topic

Post by damsprivate »

mtrs wrote:I tried a short code for this, moderators are not affected, topic last post time checked and locked upon reply attempt.

Open
posting.php
Find

Code: Select all

$current_time = time(); 
Add after

Code: Select all

$current_time = time();
//Check topic last post time and lock if last post is older than 30 days - moderators and posters above 100 post counts are not affected
    if (($mode == 'reply' || $mode == 'quote') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_') && $user->data['user_posts'] < 100)
    {
    // Learn the last post time
        $sql = 'SELECT topic_last_post_time
            FROM ' . TOPICS_TABLE . '
            WHERE topic_id = ' . $topic_id;
               
        $result = $db->sql_query_limit($sql, 1);
          
        if ($row = $db->sql_fetchrow($result))
        {
            $topic_age = $row['topic_last_post_time'];
        }
        $db->sql_freeresult($result);
                  
        if ((time() - $topic_age) > 2592000 )//The last topic post 30 days old topics, are locked
        {
        //Lock topic and give error warning
            $sql = 'UPDATE ' . TOPICS_TABLE . "
                SET topic_status = 1
                WHERE topic_id = $topic_id";
            $db->sql_query($sql);
            
            trigger_error('This topic is too old to reply, so, it\'s locked now. Thanks.');
        }   
    }
//End of lock topic         
does this effect the theme ? btw really thanks. im looking for it too.
binus university 2009 .
"did u know that 17 august ( when i join this forum ) is at Indonesia independence day ? "

Return to “[3.0.x] MOD Requests”