vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Autoclose Thread After X Days Inactivity (Works from date of last post in thread!) (https://vborg.vbsupport.ru/showthread.php?t=110320)

rwoelich 03-13-2006 10:00 PM

Autoclose Thread After X Days Inactivity (Works from date of last post in thread!)
 
Old Thread Autoclosing Hack
by Rob Woelich of www.teenhelp.org


Update - 10/29/06:
Threads that have been autoclosed have the closed icon in the forum display (thanks to Kall for the code/suggestion). Also, the "New Reply" button still shows for admins and supermods who have permission to post in the thread.

This seems to work fine on 3.6.0+, but I'm not going to bother releasing it just for that version because it's such a simple hack. If something isn't working right, verify your template edits... if you use a custom skin/style, they could be different.


DESCRIPTION:
This is a relatively simple hack that makes a thread appear "closed" after a specified amount of time. The amount of time is calculated from the last post in the thread, not from the start of the thread, making this a very effective way to keep old topics from being brought up without locking them out while they're still being discussed.

This installation consists of:
1 Product XML Upload for 3.5.0+ (should work on all versions above)
3 Template Edits in the SHOWTHREAD template
1 Image Upload (Optional, really... looks better with image though)

Into more detail:

This hack installs plugins on your showthread and newreply pages. When a user views a thread, the plugin will check the date of the last post in the thread and if the post was made more than a predetermined amount of time ago (one month by default), the thread will appear closed to the user. The thread isn't actually set as closed in the database. If a user clicks on the "Closed" button, they'll be given a No Permission message, keeping them from replying, and the Quick Reply box at the bottom of the thread will be hidden from the user as well. Administrators and super moderators by default are still able to reply to autoclosed threads and will still see the Quick Reply box.

As mentioned, the expiration time is calculated from the last post in the thread, so if a thread is autoclosed and an admin or supermod makes a post in the thread, the thread will be reopened. Since the thread isn't actually set as closed in the database, it's important to note that using the "Open Thread" option from the thread administration menu won't reopen the thread to other users. The only thing that will keep the thread open is a post existing in the thread that's dated as to deter the expiration time.

INSTALLATION:
Complete installation and template editing instructions are included in the ZIP file.

CUSTOMIZATION:
This hack was designed for a specific purpose, to keep those old annoying topics from being brought back up after two months by that one annoying newb. ;)

However, there are a few customizations available, including the usergroups that can reply in the autoclosed threads, the amount of time until a thread is autoclosed, and the message displayed at the top of the thread when the thread has been autoclosed. Customization instructions are included in the ZIP file and are extensive enough for anybody to understand. :)

OTHER:
Two screenshots of an autoclosed thread have been included. One shows the Quick Reply still visible for administrators. Please click Install if you used and liked this... :D

Tralala 03-14-2006 07:22 AM

What a nice idea. Good work!

rwoelich 03-14-2006 07:31 AM

I just updated the ZIP file because I noticed that I didn't include one of the template edits to put the autoclose message at the bottom of the thread like in the screenshot. It should all be good now, though. ;)

LeeCHeSSS 03-14-2006 04:56 PM

Would it be possible to only apply this in certain specific forums?

rwoelich 03-14-2006 09:19 PM

Sure! Give me two seconds and I'll give you a modified code sample.

Ok, here it is... to apply this hack to only certain forums:

Open the plugin for the showthread_getinfo hook and find:
PHP Code:

if ($thread['lastpost'] < (TIMENOW 2592000)) 

And replace it with:
PHP Code:

if ($thread['lastpost'] < (TIMENOW 2592000) AND (in_array($thread['forumid'], array(1,2,3)))) 

...changing 1,2,3 to the forum ids you want to apply the hack to (you can add more or less as you please). Then in the newreply_start plugin, find:
PHP Code:

if (($threadinfo['lastpost'] < (TIMENOW 2592000)) AND ($vbulletin->userinfo[usergroupid]!=AND $vbulletin->userinfo[usergroupid]!=5)) 

And replace with:
PHP Code:

if (($threadinfo['lastpost'] < (TIMENOW 2592000)) AND ($vbulletin->userinfo[usergroupid]!=AND $vbulletin->userinfo[usergroupid]!=5) AND (in_array($thread['forumid'], array(1,2,3)))) 

On the other side, if you want to exclude only a few forums from using this hack, use the same procedure, but add an ! in front of the in_array (to look like !in_array) and then the forum id numbers you use would be the forums that you don't want to apply the hack to. Depending on whether you're excluding or including more forums, you may use either method. Use the one that you'll have to type the least forum ids.

;)

Fergal C 03-26-2006 12:35 PM

Great idea, might use it to help control spam posts.

Tinbendr 03-30-2006 01:08 AM

Clicked installed.

I have the Quick Reply turned off for ALL users, (a useless feature IMO), but the quickreply box is showing anyway.

bada_bing 03-30-2006 02:34 AM

Looks like a sweet hack and something I need for my selling and trading forums.
I do have a couple questions before I click install.

- Will this work on vb 3.5.3 ?

- Also when does this hack start closing threads older then 30 days with no activity , does it start closing already created thread that are beyond 30 days with no activity or does it start with new threads created after the hack is installed?

- Also if this hack checks dates everytime a user enters that thread what is the query count and server load like?

Thanks

Logikos 04-04-2006 05:36 AM

Hmm.. this is like mine here. https://vborg.vbsupport.ru/showthread.php?t=82827

kall 04-04-2006 09:23 AM

Quote:

Originally Posted by LiveWire

Similar yes. Normally, I would choose yours, but this one has the cute little box that tells the user about the fact that it has expired. :)

Chuck that in and you have a winner.


All times are GMT. The time now is 02:13 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01184 seconds
  • Memory Usage 1,756KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete