Release status: stable | |
|---|---|
| Implementation | User interface,API,Tag |
| Description | Provides a commenting system for wikis. |
| Author(s) | |
| Latest version | 9.0.0 (2025-07-18) |
| Compatibility policy | For everyMediaWiki release that is a Long Term Support release there is a corresponding branch in the extension. |
| PHP | >= 8.0 |
| Database changes | Yes |
| Composer | mediawiki/comment-streams |
| Tables | cs_comments cs_replies cs_votes cs_watchlist |
| License | MIT License |
| Download | |
| Example | meza.wiki/commentstreams |
CommentStreams | |
| |
| |
| |
| |
| Translate the CommentStreams extension if it is available at translatewiki.net | |
| Issues | Open tasks ·Report a bug |
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 some other extensions are installed:
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.
require section of yourcomposer.local.json. Example:{"repositories":[{"type":"vcs","url":"https://github.com/wikimedia/mediawiki-extensions-CommentStreams.git"}],"require":{"mediawiki/comment-streams":"9.0.*"}}
composer update --no-devwfLoadExtension('CommentStreams');
DISPLAYTITLE, you will need to set the following variables:$wgAllowDisplayTitle=true;$wgRestrictDisplayTitle=false;
The update should be full automatic. In case you want to switch the "storage mode" from "namespace-page" to "talk-page", please executeextensions/CommentStreams/maintenance/migrateToTalkPageStorage.php after the update.
Two major changes were added in Version 7.0 that require special care upon upgrading:
The change to the database schema requires that you first upgrade to version 6.3 if you are running an earlier version and then upgrade to version 7.0. If you want to upgrade to a version after version 7.0, upgrade to version 7.0 first.
With respect to comment block ids, in versions prior to 7.0 thecst_id column of thecs_comment_data table stored the MD5 hash of the comment block name prepended by 'csc_' except for the default comment block, which is designated by 'cs-comments' in thecst_id column.This made it extremely difficult to maintain comment blocks.If a comment block was renamed in wikitext, there was not an easy way to identify which rows needed to get adjusted.
Version 7.0 replaces the value in the comment id column with null for the default comment block and with the name of the comment block (unhashed) for named comment blocks.It no longer uses the comment block name as an id for the element in the DOM.Version 7.0 includes three maintenance scripts that can be used to update the database and to move comments between comment blocks:
extensions/CommentStreams/maintenance/MigrateToAbstractSchema.php is run on upgrade bymaintenance/update.php to null out the comment id column for rows that previously were set to 'cs-comments' (the default comment block) and to change the database schema. You should not need to run this script directly, as it is run once bymaintenance/update.php.extensions/CommentStreams/maintenance/listCommentBlocks.php lists all of the comment blocks either across the entire wiki or, with the 'pages' option, sorted by the page they appear on.extensions/CommentStreams/maintenance/migrateCommentBlock.php takes the unhashed name of a comment block and either replacescst_id with the unhashed name for all rows that currently hold 'csc_' followed by the hashed name - or - takes both a from name and a to name to rename any comment block.extensions/CommentStreams/maintenance/migrateDefaultCommentBlock.php takes an (unhashed) comment block name and migrates all comments in the default comment block to the new comment block name.To upgrade from previous versions of CommentStreams to version 7.0 or later,
maintenance/update.php.maintenance/update.php.extensions/CommentStreams/maintenance/migrateCommentBlocks.php script to rename them in the database. You can use theextensions/CommentStreams/maintenance/listCommentBlocks.php script to see which comment blocks exist in the database currently.| Configuration flag | Default value | Description |
|---|---|---|
$wgCommentStreamsNamespaceIndex | 844 | The index of the CommentStreams namespace. This defines the constantsNS_COMMENTSTREAMS andNS_COMMENTSTREAMS_TALK and assigns the valueNS_COMMENTSTREAMS + 1 toNS_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. Seeextension default namespaces. |
$wgCommentStreamsAllowedNamespaces | null | An array of indices of namespaces that will display comments by default. To display comments in namespaces not listed in$wgCommentStreamsAllowedNamespaces, use the<comment-streams /> tag function as describedbelow. If the value ot$wgCommentStreamsAllowedNamespaces is null, the value of$wgContentNamespaces will be used. To allow comments on pages with the presence of the<comment-streams /> tag function only, set$wgCommentStreamsAllowedNamespaces to -1. |
$wgCommentStreamsNewestStreamsOnTop | true | If this istrue, comments streams will be displayed with the newest comment stream on top. If it isfalse, the newest comment stream will be on the bottom. Comment streams are sorted chronologically by creation date of the head comment. |
$wgCommentStreamsInitiallyCollapsedNamespaces | [] | 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. |
$wgCommentStreamsUserRealNamePropertyName | 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. |
$wgCommentStreamsUserAvatarPropertyName | 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. |
$wgCommentStreamsShowLabels | true | Iftrue, show labels beside the Add and Reply buttons. Iffalse, do not display the labels. |
$wgCommentStreamsModeratorFastDelete | false | Iftrue, 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. |
$wgCommentStreamsEnableVoting | false | Iftrue, allows logged in users to vote thumbs up, thumbs down, or neither on top level comments. |
$wgCommentStreamsEnableSearch | true | Iftrue, disables comments from appearing in search results and titles from appearing in search auto-complete. |
$wgCommentStreamsSuppressLogsFromRCs | true | Iftrue, comment-related logs will not be added to Special:RecentChanges. |
$wgCommentStreamsStoreModel | namespace-page | Ifnamespace-page, comments will be stored in pages of$wgCommentStreamsNamespaceIndex (NS_COMMENTSTREAMS_TALK). Can be set totalk-page to store comments in a dedicated content slot of the associated talk page of a page that got commented on. |
$wgCommentStreamsNotifier | null | Set which extnesion will be used to send notifications. Ifecho,Extension:Echo will be used. Ifnotify-me,Extension:NotifyMe will be used. |
IfSemantic MediaWiki is installed, CommentStreams defines the following properties on each comment page, which can be used to query for comments:
| Property name | Type | Description |
|---|---|---|
| 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 istrue). |
| Comment down votes | Number | The number of down votes on the comment (if$wgCommentStreamsEnableVoting istrue). |
| Comment vote diff | Number | The difference between the number of up votes and the number of down votes (if$wgCommentStreamsEnableVoting istrue). |
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.
CommentStreams also offers two tag functions,<comment-streams /> and<no-comment-streams />.
<comment-streams /> enables CommentStreams on a page even if it is in a namespace in which comments are disabled.Optionally, an id for the comment block may be provided:<comment-streamsid="some-unique-id"/>.
<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.
If you want to place more than one comment block on a page, you can use<comment-streamsid="some-unique-id"/> with a different unique id in each tag.If a comment block with an id (also referred to as a named comment block) appears on the page, the default comment block (the comment block with no id) will not appear unless<comment-streams /> appears in the wikitext of the page.
The default comment block (the comment block with no id) will always be placed at the bottom of the page below the categories. (Note that this is a change from prior to version 7.0 where the default comment block would appear on the page where it appeared in the wikitext. The earlier behavior caused complications in namespaces where comments were not enabled by default.)
Named comment blocks (those with a unique id) will appear on the page where they appear in the wikitext. If you have only one comment block on a page that you want to place specifically, you can also use<comment-streamsid="{{FULLPAGENAME}}"/>
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 thecs-comment right, then all users who have theedit right are allowed to post and reply to comments.Thecs-comment right can be assigned, for example, to the groupcommenters by setting
$wgGroupPermissions['commenters']['cs-comment']=true;
If you use theLockDown extension, you might want to use this to prevent access to the Special page that shows all comments:
$wgSpecialPageLockdown['CommentStreamsAllComments']=['cs-comment'];
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 showanonymous 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 pageSpecial:Preferences#mw-prefsection-echo.
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 (seeExtension:Echo), 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 theSocialProfile 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.
$wgCommentStreamsStoreModel)$wgCommentStreamsSuppressLogsFromRCs setting to unsuppress comment logs from RecentChanges$wgCommentStreamsEnableTalk option$wgCommentStreamsEnableTalk option is unnecessary, since talk namespaces can be explicitly included in$wgCommentStreamsAllowedNamespaces, and it only adds confusion to the logic and the configuration documentation.$wgCommentStreamsAllowedNamespaces was non-null$wgCommentStreamsEnableSearch flag to enable/disable search<comment-streamsid="unique_id"/><comment-streams /> to insert comment at location of tag; previous behavior of locating comment at the bottom of the page can be retained with<comment-streamslocation="footer"/><comment-streams />$wgCommentStreamsShowLabelsAlso 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.
commentstreams type to "Special:Log" and adding logging of comment page creations, deletions and edits to "Special:Log"<comment-streams-initially-collapsed />| This extension is included in the following wiki farms/hosts and/or packages:This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |