Extension:CommentStreams

Introduction
CommentStreams is a commenting system for wikis. Users can post comments below the content on a wiki page. The comments are displayed with the user's username, linked to their user page if it exists, the creation and last modification dates of the comment, and an optional user avatar. Comments can be edited and deleted only by the comment author. Comments are added in streams which include a title and a head comment that can be replied to by other comments.

CommentStreams does not depend upon any other extensions, but it provides several additional features if Semantic MediaWiki is installed: optional, user-configurable properties to set an avatar and display name for a user as well as special properties that can be queried on each comment to provide the comment title, a link to the page to which the comment refers, and a link to the head comment if the comment is a reply.

CommentStreams stores comments on pages in the CommentStreams namespace. These pages are given a randomly-generated string of characters as the name. Users cannot edit or delete these pages directly. A database table stores the comment title and ids of the page to which the comment refers and the page containing the head comment if the comment is a reply.

Installation
After requiring CommentStreams,  must be run to update the database with the CommentStreams tables.

Configuration parameters
CommentStreams has several configuration settings which should be included (below the require_once call in MW 1.24, or anywhere in LocalSettings.php on MW 1.25+):


 * You must define the value of NS_COMMENTSTREAMS in LocalSettings.php. Include this line:


 * defines whether CommentStreams should be enabled on talk pages. If true, for all namespaces that CommentStreams is enabled on, it is also enabled on the corresponding talk namespace. Defaults to false.


 * is an array which defines which namespaces CommentStreams should be enabled on. This array must take non-talk namespaces (even-numbered namespaces). Defaults to the wiki's content namespaces.


 * is an array which defines which namespaces will show all threads initially collapsed on page load. By default, if a namespace appears in  but not , all threads are initially expanded on page load. (If a namespace shows up here, but does not appear in  , it is ignored.)


 * defines the order in which streams (discussions) appear on the page. If true, the most chronologically recent streams appear on top. Defaults to false. Regardless of this variable, replies to discussions are always ordered with the newest replies at the bottom of the thread, as with a traditional forum/commenting system.

Semantic MediaWiki Support
CommentStreams defines the  constant for the CommentStreams namespace, which can be used alongside Semantic MediaWiki. The following variables may be used:
 * Enables the CommentStreams namespace to be searched by default in MediaWiki
 * Enables CommentStreams to work with Semantic MediaWiki
 * is a string which defines what SMW property the comment's title should be stored in on the CommentStreams page. Default value is 'Comment Title'. This allows comments to be queryable.
 * Enables CommentStreams to work with Semantic MediaWiki
 * is a string which defines what SMW property the comment's title should be stored in on the CommentStreams page. Default value is 'Comment Title'. This allows comments to be queryable.

Display Name Configuration Options
CommentStreams supports the use of real names instead of usernames in comments, with the following order of priority:
 * Highest priority: SMW integration. Set a real name property on a user's page - the property name is in variable  (default="Real Name").
 * Next priority: The value of the real_name field in the user table in MediaWiki.
 * Default: just shows username.

EditOwn Integration
Note: CommentStreams alone does not protect against manual editing of other peoples' comments. (It is unlikely to accidentally occur, because there are no direct links to the comment pages in the CommentStreams namespace, but it is technically possible for a skilled user.) We recommend the use of the EditOwn extension (and companion EditOwnIncludedNamespaces) to protect the CommentStreams namespace. See example configuration below.

Example Configuration
In this configuration:
 * Six namespaces will have CommentStreams enabled: main, user, and BIB_CITATION, along with their corresponding talk pages.
 * The main and BIB_CITATION namespaces will load pages with threads expanded initially, while the user namespace will load with threads collapsed initially.
 * The order of threads on any CommentStreams-enabled page will show newest streams on top.
 * CommentStreams has been enabled with SMW, and all comments will have their comment title stored in a property 'My Title' on their corresponding CommentStreams pages.
 * The  call to EditOwn and EditOwnIncludedNamespaces protects the CommentStreams namespace, preventing comments from being edited by anyone except their owners.

Disabling On A Page
CommentStreams also offers a tag function,, which disables CommentStreams on a page. By default, this instead places a message at the bottom alerting readers that comments are disabled on that page; suppress this message by using.

Known Issues

 * If CommentStreams is used on a page which uses HeaderTabs, and a comment is posted which transcludes another page using HeaderTabs, the JavaScript on the page breaks.
 * Workaround: Don't transclude pages with HeaderTabs onto pages with HeaderTabs.

Developer Notes
See Extension:CommentStreams/Developer Notes for notes on the structure of the CommentStreams extension.