Old Discussion 0.4
Old Discussion
Based on "Old Posts" by Gary Mardell. Modified to work in Vanilla 2.1 and 2.2, and with extra functionality. The old plugin hasn't been maintained for years.
Description
This plugin shows a warning text in the editor when users are commenting on an old discussion. By default, it requires users to tick a checkbox before proceeding to post the comment, but this behaviour can be changed in the settings.
The age threshold can also be changed in the plugin settings page. Default value is 90 days.
Last, there is an option to ignore comment edits. This allows choosing whether or not to show the warning when editing a comment in an old discussion.
Updated version is fully compatible with locales. This can also be used to customize the text. Check the notes below.
Differences with Necropost Warning:
Although both plugins provide a warning when commenting on old posts, they work slightly different. This one is more explicit and can optionally force users to tick a checkbox before commenting. Necropost is more subtle, showing a notification.
Note for Vanilla 2.1 users
In Vanilla 2.1, showing the warning when editing comments in old discussions won't work, as this version lacks some events the plugin requires to work. There are two ways around this:
If you don't need this functionality, you can choose to ignore edits in the plugin options. Warnings will only be shown for new comments.
If you really need to show warnings on posts, you can modify one of the files of the Vanilla Core to add the missing Events. Follow these instructions:
Open the file:
/applications/vanilla/views/post/editcomment.php
Find the line that creates the BodyBox. In Vanilla 2.1.11, it looks like this:
echo $this->Form->BodyBox('Body', array('Table' => 'Comment', 'tabindex' => 1));
Insert this new line immediately above:
$this->fireEvent('BeforeBodyField');
That's all. Now warnings should show on edits too.
Take into account that you will need to repeat this procedure if you update to a newer version of Vanilla in the 2.1.x branch, as the core files will be overwritten.
Vanilla 2.2 already incorporates this change by default.
Translation or Custom text
By request, I have made the plugin fully compatible with locales. This means all the text in the plugin can be easily customized or translated into a different language.
The plugin has only a few strings, so making your own translation is very simple. Follow these steps:
To customize text:
1. Simply open the file OldDiscussion/locale/en-CA and edit the strings on the right side of the = sign.
To translate to a new locale:
1. Make a copy of the base locale (en-CA) found on the OldDiscussion/locale folder.
2. Rename the new copy to the target locale name. You can find this name under the description of each locale in the list of installed locales, found on the dashboard (Navigate to Addons / Locales in the side menu). It looks like this:
Locale: fr | Version: .......
In this example, the new copy should be renamed to "fr.php"
3. Open the renamed file and translate the strings. For each definition line, you should translate only the string on the right side of the = sign. I have separated the front-end text from the dashboard text. Only admins can see the dashboard.
4. After saving the translated file it will work straight away as long as the target locale is enabled and set as default in your dashboard settings.
5. If your target locale is active, but the plugin is still showing in the old language (for instance, you can see all text in French but the plugin is in English), try deleting the locales cache file at vanilla_root/cache/locale_map.ini
English and Spanish translations are already provided.