Extension:ArticleComments
|
ArticleComments Release status: stable |
|||
|---|---|---|---|
| Implementation | Tag | ||
| Description | Inserts blog-like comment forms into articles. | ||
| Author(s) | Jim R. Wilson (Jimbojw) | ||
| Last version | 0.4.3 | ||
| MediaWiki | 1.6.x, 1.8.x, 1.9.x, 1.12.x and later | ||
| Database changes | no | ||
| License | The MIT License | ||
| Download |
SVN [?]:
orArticleComments.php |
||
| Example | ArticleComments Test Page | ||
|
|||
| Check usage and version matrix | |||
The ArticleComments extension provides a means for creating inline blog-like comment forms for regular wiki articles.
Please see the official project homepage for up-to-date installation notes, usage tips and advanced features.
- Project Homepage
- ArticleComments Extension - Jimbojw.com
- Source Code
- ArticleComments.php
- Demo
- ArticleComments Test Page (try before you install)
- Licensing
- ArticleComments is released under The MIT License.
Contents |
Installation [edit]
- Download ArticleComments, and be sure to rename the downloaded file to ArticleComments.php.
- Drop this script in $IP/extensions
- Note: $IP is your MediaWiki install directory.
- Enable the extension by adding this line to your LocalSettings.php:
require_once('extensions/ArticleComments.php');
Version 1.16.x [edit]
require_once("$IP/extensions/ArticleComments/ArticleComments.php");
Usage [edit]
Once installed, you (or editors of your wiki) may add comment forms to any article.
To do so, simply add this text to the body of your page where you'd like the comment form to appear:
<comments />
That's it!
Customization [edit]
The user interface can be customized without modifying any extension or MediaWiki core code.
Comment display format [edit]
To customize the comment display format:
- Edit the page MediaWiki:Article-comments-new-comment.
(You must be logged in as the site administrator to edit pages in this special namespace.)
The variable fields are defined as follows:
- $1: {user name} said ...
- $2: {comment body}
- $3: {user name ) {links to user:profile)
- $4: {date}
This layout applies to new comments posted after the change. Previous comments will have been saved with the old layout.
- Usage: Lay out the variables and customize the comment appearance with HTML/CSS. See "Forum-like CSS" below
Forum-like CSS [edit]
- Description
- Article which shows alternate CSS for a more forum-like appearance. Also illustrates some basic configuration options.
- Documentation
- How to add comment guestbook forum to MediaWiki (LeerWiki.nl)
Remove the URL field [edit]
- To globally remove all URL fields from all ArticleComments forms, add this to your LocalSettings.php file somewhere after the require() call:
$wgArticleCommentDefaults['showurlfield'] = false;
Display the comment entry form [edit]
- To globally display the comment form by default, try:
$wgArticleCommentDefaults['hideform'] = false;
Comments directly on the article page [edit]
If you want to add the comments in your page, use this code:
<comments />{{:{{TALKSPACE}}:{{PAGENAME}}}}
Technical Details [edit]
In addition to providing a parser hook for the <comments> tag, the ArticleComments Extension implements a SpecialPage which acts as the recipient of the submitted comment.
Though this special page shows up in Special:Specialpages as "Process Comment", it is not meant to be accessed directly - only via a comment submission form.
When a comment is submitted, if all fields are correctly filled, with no illegal values, the comment is appended to the end of the Article's Talk page. If the comment form is itself on a Talk page, then the comment is appended to the end of that same page. (Comments are always appended to Talk pages - never pages in any other namespace).
- Note: MediaWiki rel.1.15.2 (at least) generates an error and doesn't display the form:
<b>Warning</b>: Parameter 3 to wfArticleCommentsParserHook() expected to be a reference, value given in <b>{wiki-server-dir}/includes/parser/Parser.php</b> on line <b>3243</b>
To correct this error:
- Open wfArticleCommentsParserHook() in a text editor.
- Find the function wfArticleCommentsParserHook and replace &$parser with $parser
Extension Points [edit]
As of version 0.4, this extension registers its own hook called "ArticleCommentsSpamCheck" and provides a default rudimentary implementation.
This is to aid future development of more robust spam checking mechanisms without altering the extension's core code.
Caveats and Gotchas [edit]
This extension does not implement any permission checks other than whether the user or ip address is blocked from making edits. This means that if a comment form is placed on an article, any user or guest may use that form to supply a comment.
The goal of this extension is to provide comment forms that are intuitive for people who are not wiki experts, not just to make it easier to append content to an article's talk page. It is presumed that if an editor places a <comments /> flag in an article, then that article is designated as accepting input from any users.
A future version of this extension may be more permissions-aware however.
Related Works [edit]
For those of you brave enough to try (and extend/augment) this extension, feel free to list your works below. --Jimbojw
Simple AntiBot Tricks [edit]
This can help blocking spambots from posting spams in your website.
See Extension_talk:ArticleComments#SimpleAntiBot for details. (Perma link)
Collapsible Comments directly on the article page (using javascript) [edit]
I made a modification to this extension for it to add directly the comments on the article page. Moreover, these comments are hidden by default and are displayed using javascript when the user clicks on "Show comments".
See User:Pannini/ArticleComments to follow the modifications. This is more than a hack, it simply adds a new functionality to ArticleComment.
Logged-In Users Only [edit]
For systems where you don't want un-logged-in readers to be able to post comments - the correct solution would be to change this code so it respects $wgGroupPermissions['*']['edit'] and $wgGroupPermissions['*']['edittalk'] - but a quick and dirty hack is to alter the function which determines whether the user is blocked, from
# Check whether user is blocked from editing the talk page
if ($wgUser->isBlockedFrom($talkTitle)) {
to
# Check whether user is blocked from editing the talk page
if ($wgUser->isBlockedFrom($talkTitle) || !$wgUser->isLoggedIn()) {
98.216.245.28 15:42, 17 May 2009 (UTC) (sorry, no mediawiki account, and yes, I'm aware of the irony)
Version that supports MediaWiki 1.20wmf10 [edit]
See my updated version of this extension at http://www.futureofmankind.co.uk/Billy_Meier/Extension:ArticleComments Jamesgtmoore (talk) 00:44, 8 September 2012 (UTC)
See also [edit]
- Extension:Matrix list of all extensions
- Extension:WordPress Comments
- User:Subfader/Article Comments