Extension:Comments
|
Comments Release status: stable |
|||
|---|---|---|---|
| Implementation | Parser extension | ||
| Description | Adds <comments> parser hook tag that allows commenting on articles | ||
| Author(s) | David Pean Misza Jack Phoenix |
||
| Last version | 2.7 | ||
| MediaWiki | 1.18+ | ||
| License | GNU General Public License 2.0 or later | ||
| Download | |||
|
|||
|
|||
|
|||
|
|||
| Check usage and version matrix | |||
| Bugs: list open list all report | |||
Comments extension adds the <comments> parser hook tag to allow commenting on articles where the tag is present.
Comment actions are logged to Special:Log/comments, but by default they're hidden, just like patrol log entries.
Majority of the code fixes were done by Misza and Jack Phoenix.
Right now this extension requires MySQL DBMS, but patches to add PostgreSQL/Oracle/etc. support are more than welcome!
Contents |
Dependencies [edit]
- New database tables: Comments, Comments_block and Comments_Vote — these tables currently cannot be created by running update.php, the official MediaWiki updater script, but instead you have to create them manually!
Installation [edit]
- Download the files into $IP/extensions/Comments
- Create the three required database tables (see comments.sql for the schemas)
- Add
into the wiki's LocalSettings.phprequire_once("$IP/extensions/Comments/Comment.php");
- Installation can now be verified through the wiki's Special:Version
Usage [edit]
- <comments /> — basic comment form, sufficient for most things
<comments allow="Derfel,Jack Phoenix,Misza" />— only allows the users Derfel, Jack Phoenix and Misza to submit comments<comments voting="Plus" />— prevents users from rating comments negatively (thumb down), allowing only positive (thumb up) votes
Comments of the Day [edit]
The extension also comes with a "Comments of the Day" feature (<commentsoftheday />), which by default is not enabled. You can enable this feature in the wiki's LocalSettings.php, by adding the following after the require_once() line:
If the nocache argument is passed to the parser hook (like this: <commentsoftheday nocache=true />), the parser hook will not use memcached and will just fetch the data from the database instead of cache. This is useful if you want to show the most up-to-date data, but it can be very server-intensive.
User rights [edit]
This extension adds two new user rights, comment (which allows posting comments) and commentadmin (which allows deleting user-posted comments). By default, everyone, even anonymous users, can post comments, but only users in the commentadmin group can delete them.
User points [edit]
- $wgUserStatsPointValues['comment_plus'] — amount of points to give out when another user gives "thumbs up" to your comment.
- $wgUserStatsPointValues['comment_ignored'] — amount of points to give out when another user adds your comments to their ignore list (Special:CommentIgnoreList).
Parameters [edit]
- $wgCommentsDefaultAvatar — path to an image which will be displayed instead of an avatar if social tools (SocialProfile extension) aren't installed. Should be 50x50px.
Hooks [edit]
Comments extension adds two hooks, Comment::add and Comment::delete.
| Hook name | When it is called | Parameters |
|---|---|---|
| Comment::add | After a comment has been added into the database, on the bottom of Comment::add function |
|
| Comment::delete | After a comment has been deleted and the caches have been purged (function delete on class Comment) |
|
Internationalization [edit]
| Message | English default | Description |
|---|---|---|
| comment-comment | Comment | This message might be unused. |
| comments-db-locked | <h3>Adding Comments</h3>The database is currently locked for routine database maintenance, after which it will be back to normal. Please check back later! | Displayed if a page contains the <comments /> tag while the database is locked. |
| comment-voted-label | Voted | |
| comment-loading | Loading... | |
| comment-auto-refresher-enable | Enable Comment Auto-Refresher | |
| comment-auto-refresher-pause | Pause Comment Auto-Refresher | |
| comment-reply-to | Reply to | This message is followed by the user's username whom you're about to reply to. For example, "Reply to Jack Phoenix". |
| comment-cancel-reply | Cancel | |
| comment-block-warning | Are you sure you want to permanently ignore all comments from | Displayed in a JavaScript popup alert when the user is about to ignore someone's comments. This message is followed by either MediaWiki:Comment-block-anon or MediaWiki:Comment-block-user, depending on the fact whether the user is an anonymous one or not. |
| comment-block-anon | this Anonymous user (via their IP address) | |
| comment-block-user | user | |
| comment-sort-by-date | Sort by Date | |
| comment-sort-by-score | Sort by Score | |
| comment-show-comment-link | Show Comment | |
| comment-manage-blocklist-link | Manage Ignore List | |
| comment-ignore-message | You are ignoring the author of this comment | Shown in the output of the <comments /> tag instead of the person's comment if you're ignoring the said person. |
| comment-you | You | Note that there is a space before the word. |
| comment-reply | Reply | |
| comment-login-required | You must be logged in to add comments | |
| comment-post | Post Comment | |
| comment-submit | Add your Comment | |
| comment-score-text | Score | |
| comment-permalink | Permalink | |
| comment-delete-link | Delete Comment | Shown to Comment Administrators only. |
| comment-anon-name | Anonymous User | |
| comment-anon-message | {{SITENAME}} welcomes <b>all comments</b>. If you don't want to be anonymous, <a href="$1">register</a> or <a href="$2">log in</a>. It's free. | Shown above the comment form to anonymous users. $1 is the URL to Special:UserLogin, $2 is the URL to Special:UserLogin/signup. |
| comment-ignore-item | <a href="$1">$2</a> on $3 <a href="$4">(unblock)</a> | Shown on Special:CommentIgnoreList. $1 is the URL to the blocked user's user page, $2 is the name of the blocked user, $3 is the timestamp (when the user was blocked) and $4 is the URL to the unblock form. |
| comment-ignore-no-users | There are no users currently blocked. | Shown on Special:CommentIgnoreList if you haven't blocked anyone's comments. |
| comment-ignore-remove-message | Are you sure you want to unblock user <b>$1</b>'s comments? | Confirmation message, shown when the user is about to unblock someone's comments on Special:CommentIgnoreList. $1 is the username of the user whose comments the user has blocked. |
| comment-ignore-unblock | Unblock | |
| comment-ignore-cancel | Cancel | |
| comment-ignore-title | Comment Ignore List | Title of Special:CommentIgnoreList, as shown on the said page. |
| commentignorelist | Comment Ignore List | Title of Special:CommentIgnoreList, as shown on Special:SpecialPages. |
| commentslogpage | Comments log | Shown on Special:Log/comments if comment logging is enabled. |
| commentslogpagetext | This is a log of comments | Shown on Special:Log/comments if comment logging is enabled. |
| commentslogentry | Do not translate this into other languages! | |
| commentslog-create-entry | New comment | Shown on Special:Log/comments if comment logging is enabled. |
| comments-create-text | [[$1]] - $2 | Do not translate this into other languages! |
| comments-time-ago | $1 ago | $1 is one of the following messages: MediaWiki:Comments-time-days, MediaWiki:Comments-time-hours, MediaWiki:Comments-time-minutes or MediaWiki:Comments-time-seconds |
| comments-time-days | {{PLURAL:$1|one day|$1 days}} | |
| comments-time-hours | {{PLURAL:$1|one hour|$1 hours}} | |
| comments-time-minutes | {{PLURAL:$1|one minute|$1 minutes}} | |
| comments-time-seconds | {{PLURAL:$1|one second|$1 seconds}} | |
| group-commentadmin | Comment Administrators | Shown on Special:ListUsers. Members of this group can delete other users' comments. |
| group-commentadmin-member | Comment Administrator | Shown on Special:ListUsers. A "Comment Administrator" is someone who is a member of "Comment Administrators" user group. |
| right-comment | Submit comments | Shown on Special:ListGroupRights |
| right-commentadmin | Administrate user-submitted comments | Shown on Special:ListGroupRights |
TODO list [edit]
- HTML output is not valid XHTML - would be nice if it were but we can live without that
- Would be nice if there was a Special Page that gives a overview of all uses of the comments extension on all pages (for an adminstrator to be able to moderate easier)
Version history [edit]
| Version | SVN revision | Release date | Comments |
|---|---|---|---|
| 2.7 | r115137 | 4 May 2012 | Fixes bug #34345, so "Delete Comment" links work again. |
| 2.6 | r111059 | 9 February 2012 | Don't show voting buttons to users who don't have the "comment" user right. |
| 2.6 | r111040 | 9 February 2012 | Fixes bug #34284 — redirect the user to the page they came from by sticking the returnto parameter to the URL. |
| 2.6 | r111037 | 9 February 2012 | Don't show "reply" links to users who aren't allowed to comment. |
| 2.6 | r108577 | 11 January 2012 | Removed the usage of deprecated LanguageGetMagic hook. |
| 2.5 | r108296 | 7 January 2012 | First version that fully supports ResourceLoader and thus requires MediaWiki 1.18 or newer. |
| 2.4.1 | r108295 | 7 January 2012 | Bugfix to Special:CommentIgnoreList: anonymous users can now be removed from the comment ignore list. |
| 2.4.1 | r97062 | 14 September 2011 | Initial public release, phase II changes:
|
| 2.3 | r1750 (ShoutWiki SVN) | 21 July 2010 | Expanded documentation, fixed an old FIXME (a better error message is now displayed if user doesn't have 'comment' user right instead of the "log in" message), removed unused $this->parser variable, fixed a bug in display() by removing the usage of $wgTitle ($wgTitle points to Special:CommentListGet instead of current page...^demon was right, $wgTitle is evil) |
| 2.3 | r1570 (ShoutWiki SVN) | 29 March 2010 | Documentation update, renamed a few variables and tweaked French (fr) translation |
| 2.3 | r1555 (ShoutWiki SVN) | 27 March 2010 | Spacing tweak in the main extension setup file |
| 2.3 | r1436 (ShoutWiki SVN) | 17 February 2010 | Removed an unused variable ($sk), changed some double quotes to single quotes, renamed a variable and broke some long lines in CommentClass.php |
| 2.3 | r1433 (ShoutWiki SVN) | 12 February 2010 | Removed unused $wgComments variable and add semicolons to JS variables |
| 2.3 | r1432 (ShoutWiki SVN) | 12 February 2010 | Fixed a bug in Special:CommentIgnoreList — it would return a "no such special page" error and was doing infinite looping by trying to redirect anons into itself instead of Special:UserLogin. Also changed a while() to foreach(), as per MediaWiki's coding conventions |
| 2.3 | r1425 (ShoutWiki SVN) | 6 February 2010 | Tweaked CommentClass.php so that it shows voted.gif if you have voted for a comment; partially reverts r848 (once again) |
| 2.3 | r1422 (ShoutWiki SVN) | 31 January 2010 | Tweaked Finnish (fi) translation of 'comment-reply-to' message |
| 2.3 | r1412 (ShoutWiki SVN) | 28 January 2010 |
|
| 2.3 | r1377 (ShoutWiki SVN) | 16 January 2010 | Added two new Dutch (nl) translations and fixed "Problem at line 108 character 19: Use '===' to compare with '0'." in Comment.js |
| 2.3 | r1361 (ShoutWiki SVN) | 5 January 2010 | Fixed E_PARSE introduced in r1357 |
| 2.3 | r1357 (ShoutWiki SVN) | 5 January 2010 | Initial Dutch (nl) translation and tweaks to French (fr) translation |
| 2.3 | r1335 (ShoutWiki SVN) | 19 December 2009 | Removed usage of deprecated ereg() function in CommentClass.php in favor of preg_match() |
| 2.3 | r1334 (ShoutWiki SVN) | 19 December 2009 | voted.gif, which was removed in r848, was added back |
| 2.3 | r1323 (ShoutWiki SVN) | 12 December 2009 | Coding style nitpicks |
| 2.3 | r1307 (ShoutWiki SVN) | 5 December 2009 | Version 2.3 — no longer requires SocialProfile |
| 2.2 | r1292 (ShoutWiki SVN) | 28 November 2009 | Fixed a fatal + PHP 5.3 bitching (Warning: Parameter 3 to displayComments() expected to be a reference, value given in ..\includes\parser\Parser.php on line 3243) |
| 2.2 | r1262 (ShoutWiki SVN) | 7 November 2009 |
|
| 2.1 | r1237 (ShoutWiki SVN) | 18 October 2009 | Removed backwards compatibility code for the parser hook, as per r55838 |
| 2.1 | r1084 (ShoutWiki SVN) | 4 July 2009 | Fix for previous commit, r1083. |
| 2.1 | r1083 (ShoutWiki SVN) | 4 July 2009 | New configuration global, $wgCommentsDefaultAvatar, for setting the URL of a default avatar which will be used on non-social wikis + bumped version to 2.1 |
| 2.0 | r1082 (ShoutWiki SVN) | 3 July 2009 | Removed silly default AUTO_INCREMENT values from the SQL file |
| 2.0 | r1081 (ShoutWiki SVN) | 3 July 2009 |
|
| 2.0 | r1066 (ShoutWiki SVN) | 2 July 2009 | Added the Comment::delete hook into Comment::delete() for Extension:LinkFilter |
| 2.0 | r1064 (ShoutWiki SVN) | 2 July 2009 | Added the Comment::add hook into Comment::add() for Extension:LinkFilter |
| 2.0 | r1038 (ShoutWiki SVN) | 26 June 2009 | Fixed some E_STRICTs in CommentClass.php |
| 2.0 | r1036 (ShoutWiki SVN) | 22 June 2009 | Tweaked variable name as per the coding conventions |
| 2.0 | r1023 (ShoutWiki SVN) | 13 June 2009 | Removed displayCommentScorecard() function, related code snippets and some unused code from function display() |
| 2.0 | r1022 (ShoutWiki SVN) | 13 June 2009 | Removed EOL whitespace and some commented-out code |
| 2.0 | r1021 (ShoutWiki SVN) | 13 June 2009 | Cleanup & documentation to main class file |
| 2.0 | r1020 (ShoutWiki SVN) | 13 June 2009 | Added a semicolon after a function call in Comment.js |
| 2.0 | r1019 (ShoutWiki SVN) | 13 June 2009 | Cleanup to AjaxFunctions file — removed class_exists() checks for Publish stuff (we don't want that) + changed all $Comment variables to $comment as per coding conventions |
| 2.0 | r1018 (ShoutWiki SVN) | 13 June 2009 | Changed $ to document.getElementById in Comment.js |
| 2.0 | r1017 (ShoutWiki SVN) | 13 June 2009 | Removed a line which was commented out from Comment.js |
| 2.0 | r943 (ShoutWiki SVN) | 21 May 2009 | Removed EOL whitespace and added copyright |
| 2.0 | r920 (ShoutWiki SVN) | 7 May 2009 | Removed a fixme comment from Comment.js |
| 2.0 | r895 (ShoutWiki SVN) | 2 May 2009 | Changed urlencode to htmlspecialchars in Comment::display(). Code by Pinky |
| 2.0 | r894 (ShoutWiki SVN) | 2 May 2009 | Very odd CSS fix for an odd CSS issue. Reply/permalink links were misaligned in Monobook, Modern etc. but not in Nimbus or Monaco. This fixes those links for Monobook, Truglass, phpBB and partially for Modern (looks like it needs 40px or something). Nimbus and Monaco both override this later on back to 10px so it's also looking good on those skins. |
| 2.0 | r893 (ShoutWiki SVN) | 2 May 2009 | Added a space after every semicolon in Comments.css; no functional changes |
| 2.0 | r872 (ShoutWiki SVN) | 25 April 2009 | Added plurals for time-related messages ('comments-time-days', 'comments-time-hours', 'comments-time-minutes' and 'comments-time-seconds') |
| 2.0 | r871 (ShoutWiki SVN) | 25 April 2009 | Tweaked the wording of the 'comment-anon-message' internationalization message |
| 2.0 | r870 (ShoutWiki SVN) | 25 April 2009 | Cleanup to JavaScript file (double quotes → single quotes where appropriate, add missing semicolons, tweak spacing and so on) |
| 2.0 | r869 (ShoutWiki SVN) | 25 April 2009 | Fix show_comment JavaScript function — now actually shows the previously-hidden comment in addition to hiding the "you are ignoring the author of this comment" message |
| 2.0 | r868 (ShoutWiki SVN) | 25 April 2009 | JavaScript fix — alert would previously say "object Object", now it actually says "ok" |
| 2.0 | r867 (ShoutWiki SVN) | 25 April 2009 | Added internationalization messages 'group-commentadmin' and 'group-commentadmin-member' for Special:ListUsers |
| 2.0 | r866 (ShoutWiki SVN) | 25 April 2009 | Removed an unnecessary closing span tag for XHTML compliance in CommentClass.php, function display() |
| 2.0 | r865 (ShoutWiki SVN) | 25 April 2009 |
|
| 2.0 | r864 (ShoutWiki SVN) | 25 April 2009 |
|
| 2.0 | r863 (ShoutWiki SVN) | 25 April 2009 | Converted a raw SQL query to use the Database wrapper class in CommentClass.php, function getCommentList() |
| 2.0 | r861 (ShoutWiki SVN) | 25 April 2009 | Use wfReadOnly() rather than $wgReadOnly + bumped version number from 1.1 to 2.0 |
| 1.1 | r860 (ShoutWiki SVN) | 25 April 2009 | Totally removed the updateStats() function and calls to it in CommentClass.php |
| 1.1 | r854 (ShoutWiki SVN) | 24 April 2009 | Commented out the updateStats function in CommentClass.php, we don't need nor want it |
| 1.1 | r849 (ShoutWiki SVN) | 24 April 2009 | Call functions of Vote and Publish classes only if said classes exist in Comments_AjaxFunctions.php |
| 1.1 | r848 (ShoutWiki SVN) | 24 April 2009 |
|
| 1.1 | r847 (ShoutWiki SVN) | 24 April 2009 | Changed a double-equals comparison operator in Comments_AjaxFunctions.php to triple-equals comparison operator to fix a bug |
| 1.1 | r829 (ShoutWiki SVN) | 18 April 2009 | Spacing, removed some unused globals, fixed userlogin links for non-English languages (canonical name is not CamelCased), converted Title::makeTitle to SpecialPage::getTitleFor |
| 1.1 | r668 (ShoutWiki SVN) | 13 March 2009 | Removed unused globals, add spacing, changed some DB_MASTERs to DB_SLAVEs, converted a raw SQL query to use the Database class + XHTML compliance |
| 1.1 | r667 (ShoutWiki SVN) | 13 March 2009 | Cleanup to AJAX functions file — removed unused globals, added spacing and changed one DB_MASTER to DB_SLAVE |
| 1.1 | r450 (ShoutWiki SVN) | 20 January 2009 | Added internationalization messages for Special:ListGroupRights ('right-comment' and 'right-commentadmin') |
| 1.1 | r352 (ShoutWiki SVN) | 28 December 2008 | General code cleanup, coding style cleanup, marked one function as public static to stop PHP from whining, changed double quotes to single quotes, used DB_SLAVE instead of DB_MASTER for read queries, used MediaWiki's Database wrapper class whenever possible and added some newlines to HTML output |
| 1.1 | r262 (ShoutWiki SVN) | 6 December 2008 | Added calls to Database::commit() whereever needed |
| 1.1 | r172 (ShoutWiki SVN) | 14 November 2008 | Merged r3449 from Wikia codebase: "spam check no longer compatible..remove for now" |
| 1.1 | r137 (ShoutWiki SVN) | 14 November 2008 | Fixed a minor display bug by adding a linebreak to Comment::displayOrderForm() output right before it is returned and removed an unused global ($wgUploadPath) from the same function |
| 1.1 | r136 (ShoutWiki SVN) | 30 October 2008 | Added missing $wgUploadPath global declaration to Comment::display() in CommentClass.php |
| 1.1 | r135 (ShoutWiki SVN) | 30 October 2008 | Added new images directory, moved all images there and changed paths in CommentClass.php accordingly |
| 1.1 | r132 (ShoutWiki SVN) | 29 October 2008 | Loaded AJAX functions file in the main extension setup file |
| 1.1 | r108 (ShoutWiki SVN) | 17 October 2008 | Initial French translation |
| 1.1 | r72 (ShoutWiki SVN) | 9 October 2008 | Missing internationalization message 'comments-time-days' added |
| 1.1 | r70 (ShoutWiki SVN) | 5 October 2008 | Removed dependency on GlobalFunctionsNY.php and removed CSS duplication |
| 1.1 | r67 (ShoutWiki SVN) | 4 October 2008 | Fixed some database declarations again ($dbr should be used for slaves and $dbw for master) |
| 1.1 | First working version by Misza | ||
| 1.0 | Initial cleaned-up version of extensions/wikia/Comments/ by Jack Phoenix |
| Social tools | |
|---|---|
| SocialProfile | Overview • UserStatus (GSoC 2011 project) • Roadmap • Developer info • Screenshots • History |
| Other social extensions | Automatic Board Welcome • BlogPage • FanBoxes • NewUsersList • PictureGame • PollNY • QuizGame • RandomFeaturedUser • RandomGameUnit • RandomUsersWithAvatars • SiteMetrics • UserWelcome |
| Semanticness | Semantic Social Profile |
| Other related extensions (which do not depend on SocialProfile) |
Comments • LinkFilter • NewSignupPage • RandomImageByCategory • Video • VoteNY • WikiTextLoggedInOut |