Release status: stable
|Implementation||User interface, API, Tag|
|Description||Provides a commenting system for wikis.|
|Latest version||4.5 (2018-07-05)|
|Translate the CommentStreams extension if it is available at translatewiki.net|
|Check usage and version matrix.|
|Issues||Open tasks · Report a bug|
- 1 Introduction
- 2 Installation
- 3 Configuration
- 4 Semantic MediaWiki support
- 5 CommentStreams namespace
- 6 Enabling and disabling comments on a page
- 7 Placement of comments
- 8 Initially collapsed CommentStreams
- 9 Comment right
- 10 Anonymous comments
- 11 Echo support
- 12 Comment moderation
- 13 Avatar
- 14 Examples
- 15 Version History
- 16 Known issues
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.
If Extension:Echo is installed, web and email notifications are sent to users who have enabled them when comments are added on pages the user is watching or replies are posted to comments authored by the user. If Extension:Echo is installed, the minimum MediaWiki version required is 1.27.
If Extension: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.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'CommentStreams' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required.
- Because CommentStreams uses , you will need to set the following variables:
$wgAllowDisplayTitle = true; $wgRestrictDisplayTitle = false;
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
|Configuration Flag||Default Value||Description|
||844||The index of the CommentStreams namespace. This defines the constants NS_COMMENTSTREAMS and NS_COMMENTSTREAMS_TALK and assigns the value NS_COMMENTSTREAMS + 1 to NS_COMMENTSTREAMS_TALK. NS_COMMENTSTREAMS is configured to be a content namespace, and it is configured to be searchable. If Semantic MediaWiki is installed, it is also configured to allow semantic properties. See Extension_default_namespaces#CommentStreams.|
||null||An array of indices of subject (i.e. non-talk) namespaces that will display comments. If the value is null, the value of $wgContentNamespaces will be used. To disallow comments on all non-talk namespaces, set this to -1. If comments are enabled on a subject namespace, they will automatically be enabled on the corresponding talk namespace as well.|
||false||If this is true, comments are enabled on all talk namespaces. If it is false (the default), comments are only enabled on talk namespaces corresponding to allowed subject namespaces.|
||true||If this is true, comments streams will be displayed with the newest comment stream on top. If it is false, the newest comment stream will be on the bottom. Comment streams are sorted chronologically by creation date of the head comment.|
||||An array of indices of namespaces in which the comment streams will be displayed collapsed (i.e. only the head comment showing) when the page is initially rendered if comment streams are enabled in that namespace. For other namespaces with comment streams enabled, the comment streams will be displayed expanded when the page is initially rendered. After the page is rendered, comment streams can be toggled between being expanded and collapsed by clicking on the EXPAND/COLLAPSE toggle button in the top right of the comment stream.|
||null||If Semantic MediaWiki is installed, this variable is given a Text value, and a property named with that value exists on a user's user page, then the value of that property will be used as the display name for that user on any comments authored by them. If this variable is not set or the property does not have a value, then if DISPLAYTITLE has been used to set the displaytitle page property of the user page, the displaytitle value will be used, Otherwise, if the user's real name is set in the database, the value from the database will be used. Otherwise, the user's username will be used.|
||null||If Semantic MediaWiki is installed and SocialProfile is not installed, this variable is given a Page or Text value, and a property named with that value exists on a user's user page, then if the value points to a File: page for an image (e.g. File:MyAvatar.png), this image will be used as an avatar for the user beside their name on any comment authored by them. If these conditions are not met, no avatar will be displayed unless the SocialProfile extension is installed. By default, the avatar will be sized to 48 pixels in height, but this can be overridden by changing the width and height properties of .cs-avatar in CSS.|
||true||If true, show labels beside the Add and Reply buttons. If false, do not display the labels.|
||false||If true, allows users with csdelete right to delete a comment and all of its replies in one action rather than having to individually delete all of the replies first.|
||false||If true, allows logged in users to vote thumbs up, thumbs down, or neither on top level comments.|
Semantic MediaWiki supportEdit
If Semantic MediaWiki is installed, CommentStreams defines the following properties on each comment page, which can be used to query for comments:
|Comment on||Page||The page that this comment refers to.|
|Reply to||Page||The page containing the head comment that this comment is a reply to if this comment is a reply.|
|Comment title of||Text||The comment title of this comment if this comment is a head comment.|
|Comment up votes||Number||The number of up votes on the comment (if $wgCommentStreamsEnableVoting is true).|
|Comment down votes||Number||The number of down votes on the comment (if $wgCommentStreamsEnableVoting is true).|
|Comment vote diff||Number||The difference between the number of up votes and the number of down votes (if $wgCommentStreamsEnableVoting is true).|
You can use the MediaWiki search box to search for comments. In the search result page, the page that the comment appears on, rather than the comment page in the CommentStreams namespace, appears in the search results. While it is possible to visit comment pages directly in the CommentStreams namespace, for example if they are listed in Special:RecentChanges, this is not encouraged. Editing, deleting, and moving comment pages by visiting them in the CommentStreams namespace is disabled. Instead editing and deleting comments is done from the content page on which the comment appears.
Enabling and disabling comments on a pageEdit
CommentStreams also offers two tag functions,
<comment-streams/> enables CommentStreams on a page even if it is in a namespace in which comments are disabled.
<no-comment-streams/> disables CommentStreams on a page even if it is in a namespace in which comments are enabled. If both of these tag functions exist on a page, the last one parsed will win.
Placement of commentsEdit
Comments will normally be placed at the bottom of the page below the categories. However, if the tag function
<comment-streams/> appears on the page, the comments will appear at the location where that tag function is placed. To enable comments on a page on which they normally would not appear, but to retain the placement at the bottom of the page, use
Initially collapsed CommentStreamsEdit
CommentStreams also offers a tag function,
<comment-streams-initially-collapsed/>, which makes comments appear initially in a collapsed state (only the comment header with the comment title, author, dates, and buttons showing) on a page. This tag function has no effect if comments are disabled on the page.
If no groups are assigned the
cs-comment right, then all users who have the
edit right are allowed to post and reply to comments. The
cs-comment right can be assigned, for example, to the group
commenters by setting
$wgGroupPermissions['commenters']['cs-comment'] = true;
It is possible to enable anonymous comments by setting
$wgGroupPermissions['*']['cs-comment'] = true;
Anonymous commenters are warned that their IP address will be recorded if they post or reply to a comment and that they will not be able to edit or delete their comments after they are submitted. While these comments show anonymous as the author on the page where the comment appears, the author's IP address does appear in the comment log and comment page history.
For a user to receive Echo notifications by web or email, the Echo extension must be installed and echo notifications must be enabled for that user. To enable CommentStreams Echo notifications by default for all users on a wiki, the following configuration should be used:
$wgDefaultUserOptions["echo-subscriptions-email-commentstreams-notification-category"] = true; // enable email notifications $wgDefaultUserOptions["echo-subscriptions-web-commentstreams-notification-category"] = true; // enable web notifications
Users may edit their notification settings by visiting the page
Notifications will be sent to a user when another user posts a new comment or a reply on a page the first user is watching. Notifications will also be sent to a user when another user posts a reply to a comment the first user is watching. A user can watch a comment by clicking on the star on the comments title bar. Clicking on the star again will remove the comment from the user's comment watchlist. When a users posts a new comment, it will automatically be added to the user's comment watchlist.
If it is taking a long time to create or reply to a comment with Echo enabled, you can have the Echo event creations done on the job queue (see Extension:Echo#Configuration), by setting the following:
$wgEchoUseJobQueue = true;
A group (csmoderators) and two new rights (cs-moderator-edit and cs-moderator-delete) exist to support comment moderation. By default, members of csmoderators have the csdelete right (they may delete any comment) but they do not have the cs-moderator-edit right (they may not edit any comment). Those rights may be assigned to other groups or changed. In addition, the
$wgCommentStreamsModeratorFastDelete configuration variable makes it easy for moderators to quickly delete entire comment threads. For example:
$wgGroupPermissions['csmoderator']['cs-moderator-edit'] = true; $wgCommentStreamsModeratorFastDelete = true;
As an aid in comment moderation, the special page
Special:AllComments lists all comments in reverse chronological order of when they were last edited.
If the Social Profile extension is installed, avatars set for users will be displayed beside the comments and replies they author. If the Social Profile extension is not installed but the Semantic MediaWiki extension is installed, the
$wgCommentStreamsUserAvatarPropertyName configuration variable can be used to specify avatars.
- Version 4.5
- Added support for Extension:VEForAll
- Version 4.4
<comment-streams/>to insert comment at location of tag; previous behavior of locating comment at the bottom of the page can be retained with
- Version 4.3.1
- Sanitized comment wikitext before passing back to the browser to avoid future XSS vulnerability.
- Version 4.3
- Version 4.2
- Fixed Special:AllComments for comments beginning with a '+'
- Added optional button label and $wgCommentStreamsShowLabels
- changed DB_SLAVE to DB_REPLICA, requiring MediaWiki 1.30+
- Version 4.1
- Removed foreign key from comment data table as it was causing issues deleting pages with comments on them for some database versions. Also named table columns correctly on table creation rather than create them with the old names then rename them. If you are updating from an earlier version, you will need to run the maintenance update script.
- Version 4.0
- Renamed the database columns to avoid conflicts with other table column names. This also fixes issue for wikis that use database table prefixes. If you are updating from an earlier version, you will need to run the maintenance update script.
- Version 3.10
- Added optional capability to allow anonymous comments
- Suppress comments on redirect pages
- Bug fix: fatal error for comments on deleted pages on Special:AllComments
- Bug fix: SQL for update script didn't include support for table prefixes
- Version 3.9.1
- Version 3.9
- Bug fixes: deletion of comments with replies and missing notifications on watched comments
- Version 3.8
- Get avatar from SocialProfile extension if it is installed
- Reworked user interface
- Added comment watchlist and reworked notifications
- Version 3.7
Special:Logand adding logging of comment page creations, deletions and edits to
- Suppressed comment page creations, deletions, and edits from
- Fixed missing subtitle on comment pages
- Version 3.6
- Added permalinks
- Fixed bug prevention comment deletion
- Added Semantic MediaWiki properties for vote counts
- Added error messages for disallowed actions on comment pages
- Version 3.5
- added comment voting
- requires a database update if voting is enabled
- fixed several bugs:
- handling of the delete button in certain pathological cases
- print out an error message if the user has been logged out (either a timeout or logout from a different window)
- Version 3.4
- Added comment moderation
- Version 3.3
- Fixed database update bug
- Version 3.2
- Fixed reply bug
- Version 3.1
- Fixed Semantic MediaWiki dependency bug
- Version 3.0
- Echo supported added
- Echo extension must be installed to enable Echo notifications; if Echo is not installed, CommentStreams continues to function without notifications
- if Echo is installed, minimum required MediaWiki version is 1.27
- if Echo is not installed, minimum required MediaWiki version is 1.25
- use OOjs UI for dialogs
- Version 2.1
- added delete "are you sure?" dialog box
- use jquery.ui.dialog for dialogs
- set text field focus when editing and creating comments
- Version 2.0
- simplified configuration
- localized strings
- made comments and comment titles searchable
- added comment modification date
- added optional user avatar
- made EditOwn unnecessary
- fixed SQL file path bug
- protected comment pages from being directly edited or deleted
- Version 1.0
- initial version
- Workaround: Don't transclude pages with HeaderTabs onto pages with HeaderTabs.
- CommentStreams is not compatible with Extension:MobileFrontend.
- CommentStreams is not compatible with Extension:Comments