Fandom

Wikia Developers Wiki

ArchiveBoards

888pages on
this wiki
Add New Page
Talk5 Share
NOTE: This script will soon become invalidated when Special:Forum is removed from the service. If you have converted to the "Discussions" feature, do not use this script.
ArchiveBoards is a script that strives to make it easier for sysops to create boards that don't allow users to post threads, nor reply to any threads within it. To prevent users trying to bypass the nature of the script, it also removes the buttons on posts so that users cannot move the thread somewhere out of the board and continue the conversation.

Suggestions to improve the scripts are fully welcomed on the talkpage. Please also let me know of any bugs as well and I will endeavour to fix them as quickly as possible!

Installation

Add this JavaScript on your wiki:

Site-wide
MediaWiki:Common.js
importArticles({
    type: "script",
    articles: [
        "u:dev:MediaWiki:ArchiveBoards/code.js"
    ]
});
importArticles — Best Practices for installing JavaScript on Fandom
The importArticles statement is designed to combine multiple HTTP requests into a single data transfer, allowing multiple scripts to load and execute faster. If you've been installing several different scripts, your JavaScript file has probably accumulated unnecessary import statements. Click "Expand" to learn how to efficiently batch import scripts to speed up performance and make your code look cleaner. One other approach is by using the MediaWiki:ImportJS.
If your JavaScript file has several lines of code that say importScript, importScriptPage, or importArticles, you may be able to combine them! By batch importing a collection of scripts with a single import, your JavaScript code will load faster and look cleaner. Consider the example below. On the left is an example of what your JavaScript file might currently look like. On the right is how you could improve that code.
Multiple imports — messy and slow One import — clean and efficient
importScriptPage('AjaxRC/code.js','dev');
 
importScript('MediaWiki:localScript.js');
 
importArticle({
  type: 'script',
  article: 'u:dev:FloatingToc/code.js'
});
 
importScriptPage('page1.js', 'wikiname');
 
importScriptPage('page2.js', 'wikiname');
importArticles({
    type: 'script',
    articles: [
        'u:dev:AjaxRC/code.js',
        'MediaWiki:localScript.js',
        'u:dev:FloatingToc/code.js',
        'u:wikiname:page1.js',
        'u:wikiname:page2.js'
    ]
});
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
But there's much more to importArticles than just this! For more examples and advanced usage, see the help page at Help:Including additional JavaScript and CSS.

Note: This script has required configuration options. You cannot import this script using the ImportJS page, as the required configuration values will not be specified before the script is fired and therefore, there will be no indication of the script having worked as intended.


Configuration

There are some custom configuration options that you can use if you want to:

Variable name Description Default value
boards An array style list of board names for where the script must be fired. This is a required property or nothing will happen As this is required, there are no default values. However, the format should be ["Board1","Board2","Board3"], where each array value is the name of a board. Underscores not required
style A list of CSS based formatting that allows the notice to be styled width: 100%;text-align: center;border: 2px solid #f66;background-color: whitesmoke;margin: 0.8em 0px;padding: 0.5em 12px;color: black;
boardNotice A notice displayed on thread listings (aka pages in the Board: namespace) Sorry, you may not create a new thread in this board. Please go back to the <a href='/wiki/Special:Forum'>Forum Index</a> to find an appropriate board.
threadNotice A notice displayed in replacement of the new reply boards on threads Sorry, you may not reply to this thread because it has been placed in a closed board.
groupCustom An optional array. If you have any custom usergroups on your wiki and you want them to be able to bypass the script, list them here (internal name is used)

The syntax for using these configuration options goes like this:

window.ArchiveBoards = {
    boards: [],
    style: "",
    boardNotice: "",
    threadNotice: "",
    groupCustom: []
};

Note that you only need to define the fields you wish to change from the defaults, and they may be defined in any order. However, this definition must precede the importArticles() call!

To-Do

  • Limit the number of boards that can be specified to prevent abuse of the script to close all board
  • Remove "closed" boards from dropdown menus, such as those on the "Start a Discussion" area on articles.

Updates

2 June 2016
Feature update (v1.0.4): The script no longer fires under the Topic namespace. Previously, it was possible to get around the removal of the posting forms to create new discussions in boards that were closed by this script using the topic board dropdown in that namespace. — SuperSajuuk
11 February 2015
Feature update (v1.0.3): The script will now display a padlock icon on Special:Forum for boards that are listed in the boards array — SuperSajuuk
9 February 2015
Minor update (v1.0.2): With thanks to Dantman, the script was updated to use a different format for creating the notices — SuperSajuuk (props to Dantman!)
16 January 2015
Bug fix update (v1.0.1): Minor fixes to existing code — UltimateSupreme
16 January 2015
Initial Release (v1.0.0). — SuperSajuuk

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.