Extension talk:Comments

From MediaWiki.org
Jump to: navigation, search

Contents

Auto refresh page[edit]

Hi. This extension is working great!

One thing I miss is an auto refresh of the page when you entered a reply to someone else or deleted a comment.
- Now, when I reply to another comment, I first need to refresh the page before I can add another reply.
- And also, when I delete a comment/reply, the message is still there, till I refresh the page, than it's gone.

Should be great if this can be fixed. I was looking into the code already, but can't really find where to add this and how to do that. —The preceding unsigned comment was added by 131.174.244.35 (talkcontribs


<comments >ulaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</comments> fsd gbdfgdfgd



hhfdhtdfh

Cannot add comments 2.7.2[edit]

Same issue as noted below, appearing in version 2.7.2. When I click add nothing happens, can not find any error-messages generated by press of the button - just seems that nothing happens. No data stored in DB-table comments.

Any ideas? —The preceding unsigned comment was added by 93.190.196.156 (talkcontribs

Try updating your version of Comments and then looking at your browser's JavaScript console for any and all JS errors. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)

Cannot add comments[edit]

Hi, I just installed the extension but I cannot add the comments. I am using the version 1.8 If I click on add the comment nothing happens. I have the tables and everything looks good on the installation.

Any help will be greatful —The preceding unsigned comment was added by 189.203.24.27 (talkcontribs

Not Working.[edit]

I've just installed this in my PC at the localhost, e looks like that it works, but I can't send any comments.

Any ideas? —The preceding unsigned comment was added by 189.38.206.71 (talkcontribs) 03:42, 31 October 2011 (UTC)

This might sound ridiculous, but it vaguely sounds like the same silly problem I just had. I'm assuming you mean the button and forms are there but won't do anything. If you happened to have manually downloaded each file, make sure that Comment.js wasn't saved as Comment.js.txt!! -81.147.29.227 02:09, 5 March 2012 (UTC)

not working in 1.170[edit]

not working in 1.170

I found a fix for it in 1.17 by changing a line in the extension's Comment.js:
var Comment {

to

var Comment = window.Comment = {

You might want to push that into the public release. ~Fern --67.121.127.113 17:25, 6 November 2011 (UTC)

The reason why it probably didn't work was because ResourceLoader messed things up. I've updated the code and now it should be RL-compatible (and it requires MediaWiki 1.18). --Jack Phoenix (Contact) 16:40, 7 January 2012 (UTC)

Spam Prevention[edit]

Hello before I attempt to install this extension I would like to know if there's any protection against spammers besides administrators going through and deleting each comment. As an example like akismet on wordpress? —The preceding unsigned comment was added by 175.239.223.175 (talkcontribs) 21:48, 22 November 2011‎ (UTC)

While there are various anti-spam extensions out there, some of which (like ConfirmEdit and SimpleAntiSpam, for example) are used on Wikimedia wikis, Comments currently doesn't support these. However, seeing that ContactPage extension supports ConfirmEdit CAPTCHAs, I believe that it might be relatively easy to add ConfirmEdit support to Comments. --Jack Phoenix (Contact) 16:40, 7 January 2012 (UTC)
thanks for the reply. Thing about captha is that its not very effective these days. I know this a long shot but possible to implement akismet - http://akismet.com/development/  ? Thing works beautifully at least on wordpress! --175.239.243.165 21:12, 7 January 2012 (UTC)
I've just tried out QuestyCaptcha and really impressed with it. That works well. Can that possibly implemented for spam prevention? If so definitely will install the extension. --175.239.131.38 23:46, 27 April 2012 (UTC)

MediaWiki Version 1.18.1 - Delete Comment did not work / Comments of the day[edit]

I just test "Comments" - was easy to install but i found 2 "bugs" in my enviroment:

1. The "Delete Comment" Link did not work. i set the rights in LocalSettings.php and have the link at the comments (if i logged in) - but the link ist "red". If i click the link, the page is reloading - but the comment isn't delete. I take a look in the scripts - but i did not find why. I try 3 different Webbrowser (IE / Firefox / Chrome) but is all the same

2. The "Comments of the day" did not work - i think the reason is that i have so social network plugin. i removed the line 94 and 95 and it will work (at this line the script ry to get the avatar and the image of the avatar

i have same problem too. i delete this from my database--Hamed.n (talk) 10:01, 21 February 2012 (UTC)

JJ-4APR2012: Same issue here... —The preceding unsigned comment was added by 68.14.221.168 (talkcontribs) 20:30, 4 April 2012


MediaWiki 1.18.1[edit]

I can not delete the comments once inserted. All other functionality seems to be working just fine.

No Delete[edit]

Comments will not delete —The preceding unsigned comment was added by 68.14.221.168 (talkcontribs) 20:31, 4 April 2012

Trouble with Comments on 1.18[edit]

I ran into a problem first where Comment.js was saved as Comment.js.txt, but I fixed it. I can not get this to work on MediaWiki 1.18 using WampServer. I tried removing sajax_do_call because I saw it was deprecated and updating the code to use $.get, but I really don't know what I'm doing.

But basically, I got the latest manually, and it isn't working for me on 1.18. If I figure out what's wrong I'll update this topic.

So now I found a problem that I'm still getting a file not found error from ResourceLoaderFileModule: script file not found: "C:\wamp\www\wiki\extensions\Comments/Comment.js"'

Note the non-WINDOWS separator in front of Comment.js

I'll see if hard coding the lines in ResourceLoaderFileModule make a difference.

I fixed it by hard-coding the lines in ResourceLoaderFileModule to use "\\" instead of "/".

COMMENT DELETED[edit]

COMMENT DELETED TO PREVENT CONFUSION Khpark87 (talk) 12:48, 6 May 2012 (UTC)

Hi Khpark87, I'm glad to see that you're interested in the Comments extension and improving its codebase. What I found strange, however, is that instead of contacting me or anyone else with commit access to svn.wikimedia.org, you decided to fork the code, pack it up as a .rar file and encourage people on this talk page to download your fork instead of the "official" version, so to say.
I don't believe in forks most of the time. Sure, sometimes they're necessary, if a project is no longer being maintained, for example. This is not the case with the Comments extension and svn.wikimedia.org in general (although, yes, svn.wikimedia.org will made completely read-only in 2013, by which I need to find a new place for hosting all the social tools and other extensions I've written).
It would've been more than preferrable had you tried to contact a developer in the first place to get your changes approved. I, for one, despite by busy schedule, am always interested in patches and making the extension's codebase better.
For what it's worth, I've fixed the issue with comment deletion in r115137 — by using a patch submitted by a user of this extension.
I sincerely wish that we can collaborate on this extension in the future instead of causing unnecessary confusion and code duplication. --Jack Phoenix (Contact) 15:10, 10 May 2012 (UTC)
Thank you for reply. To tell the truth, I was not familiar with Wiki and open source revision system such as SVN, GIT(now I am wating for approving SVN account). After read your comment, I realize that 'fork' is inefficient and Social Profile is maintained by same person, you. Sorry to make it complicated and if you allow, I want to collaborate improving Comments and Social Profile. Khpark87 (talk) 19:12, 10 May 2012 (UTC)

Chinese translation for this extension[edit]

 /* Chinese translate by zoglun@gmail.com */
$messages['zh'] = array(
	'comment-comment' => '评论',
	'comments-db-locked' => '<h3>添加评论</h3>数据库被锁死,正在进行维护,请过一段时间后再来~!',
	'comment-voted-label' => '投票',
	'comment-loading' => '读取中...',
	'comment-auto-refresher-enable' => '开启评论自动刷新',
	'comment-auto-refresher-pause' => '关闭评论自动刷新',
	'comment-reply-to' => '回复给',
	'comment-cancel-reply' => '取消',
	'comment-block-warning' => '你确信你要永久的忽视全部来自这里的评论吗?',
	'comment-delete-warning' => '你确信你想删除这段评论?',
	'comment-block-anon' => '匿名用户(显示IP地址)',
	'comment-block-user' => '用户',
	'comment-sort-by-date' => '按时间顺序排列',
	'comment-sort-by-score' => '按分数高低排列',
	'comment-show-comment-link' => '显示评论',
	'comment-manage-blocklist-link' => '管理忽略评论列表',
	'comment-ignore-message' => '你忽略了来自这个人的评论',
	'comment-you' => ' 你',
	'comment-reply' => '回复',
	'comment-login-required' => '登陆后才能留言',
	'comment-not-allowed' => '你没有足够的权限来留言',
	'comment-post' => '发表评论',
	'comment-submit' => '添加你的评论',
	'comment-score-text' => '分数',
	'comment-permalink' => '永久链接',
	'comment-delete-link' => '删除评论',
	'comment-anon-name' => '匿名用户',
	'comment-anon-message' => '{{SITENAME}} 欢迎 <b>评论</b>~!  如果你不想匿名, <a href="$1">免费注册</a> 或者 <a href="$2">登陆</a>。',
	'comment-ignore-item' => '<a href="$1">$2</a> 在 $3 <a href="$4">(解除黑名单)</a>',
	'comment-ignore-no-users' => '目前没有用户被加入黑名单。',
	'comment-ignore-remove-message' => '你确信你要把<b>$1</b>的评论移出黑名单?',
	'comment-ignore-unblock' => '解除封锁',
	'comment-ignore-cancel' => '取消',
	'comment-ignore-title' => '忽略的评论列表',
	'commentignorelist' => '忽略的评论列表',
	'comments-no-comments-of-day' => '目前没有今日评论', // for the <commentsoftheday/> parser hook
	'commentslogpage' => '评论日志',
	'commentslogpagetext' => '这是评论的日志',
	'commentslogentry' => '', # For compatibility, don't translate this
	'commentslog-create-entry' => '新评论',
	'comments-create-text' => '[[$1]] - $2', # Don't translate this
	'comments-time-ago' => '$1 之前',
	'comments-time-days' => '{{PLURAL:$1|一天|$1 天}}',
	'comments-time-hours' => '{{PLURAL:$1|一小时|$1 小时}}',
	'comments-time-minutes' => '{{PLURAL:$1|一分钟|$1 分钟}}',
	'comments-time-seconds' => '{{PLURAL:$1|一秒|$1 秒}}',
	'log-show-hide-comments' => '$1 评论日志', // For Special:Log
	// For Special:ListUsers - new commentadmin group
	'group-commentadmin' => '评论管理',
	'group-commentadmin-member' => '评论管理员',
	// For Special:ListGroupRights
	'right-comment' => '提交评论',
	'right-commentadmin' => '管理用户提交的评论',

--Zoglun (talk) 05:15, 13 June 2012 (UTC)

Thank you for your contribution, Zoglun! I've committed your Chinese translation to SVN in r115505. --Jack Phoenix (Contact) 11:46, 13 June 2012 (UTC)

Automatically add to pages[edit]

Is there a way to add the comments to every page in the main namespace automatically instead of manually inserting the tag at the end of the article? I'm very new to the backend of MediaWiki, so perhaps there's something I'm missing. —Topher208 (talk) 21:05, 3 July 2012 (UTC)

If you have a basic knowledge about coding, you can use ArticleViewHeader hook. Worked for me in HelpCommons extension. Cheers, Tim (SVG) 22:11, 3 July 2012 (UTC)

Download not available[edit]

I tried to download this extension using http://www.mediawiki.org/wiki/Special:ExtensionDistributor/Comments. Got 404 error. How can I download it? —The preceding unsigned comment was added by 1.23.201.162 (talkcontribs


Ext dist is broken for non git extensions at the moment. You can download directly from http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Comments/ Bawolff (talk) 12:38, 16 July 2012 (UTC)

Comment moderation[edit]

Will there be a possibility of some kind of moderation in later releases? So anonymous users can post comments without having an account but giving the admin the possibility to accept or refuse comments before publishing them?

87.139.121.244 06:24, 25 July 2012 (UTC)

Maybe in future releases, yes. It sounds like a feature that would be nice to have (but I'm not actively working on building such a thing at the moment). --Jack Phoenix (Contact) 19:04, 7 September 2012 (UTC)

Only works once.[edit]

Hi, I installed this extension on the 1.19 version of Mediawiki. At first, everything works just fine. But when I post a comment, everything stops working entirely -- and by everything, I'm assuming it's just the Javascript. Basically, once a comment is posted and until I manually refresh the page, neither the delete nor reply functions work. When I hit delete, nothing happens at all. When I hit reply, it simply takes me to the bottom of the page and doesn't activate the reply script. Now, I'm good with PHP, but Js is an absolute foreign land for me, so any help is appreciated.

EDIT: OK, I applied a quick and dirty fix by having the thing reload the page whenever a comment is posted. Now, everything works fine, since the delete and reply functions don't break the script.

EDIT: So, since the refresh thing works, I've tracked everything down to that "ugly" viewComments function. Something it does seems to break everything. —The preceding unsigned comment was added by 75.58.116.24 (talkcontribs


Do comments cause a watchlist notification?[edit]

When someone adds a comment to an article, and users are watching the article, does the added comment produce a watchlist notification? Thanks. Maiden taiwan (talk) 15:00, 7 September 2012 (UTC)

I believe it doesn't cause a watchlist notification, but do tell me if I'm mistaken (I haven't ever tested that out to be honest). --Jack Phoenix (Contact) 19:04, 7 September 2012 (UTC)
This is a great extension but it is hampered but the inability to generate a watchlist notification. If someone comments on an article, the people on the watchlist and especially the authors are going to want to know that a comment has been posted. Otherwise, the comment does not really add value to the conversation. We've implemented this extension on our company wiki and it is generating negative feedback for this reason. I love the extension but people don't want to have to check their articles manually to see if anyone has commented. Konjurer (talk) 19:36, 20 January 2014 (UTC)
Modify CommentClass.php just after $log->addEntry and before wfRunHooks, as shown below. This was tested successfully with MediaWiki 1.21.1.
                $log = new LogPage( 'comments', false /* show in RecentChanges? */ );
                $log->addEntry( '+ comment', $wgUser->getUserPage(), $message );
                // Add the following:
                # E-mail notifications
                // Modified from RecentChange.php core MW code:
                global $wgUseEnotif, $wgShowUpdatedMarker;

                if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
                        if ( wfRunHooks( 'AbortEmailNotification', array( $wgUser, $pageTitle, $this ) ) ) {
                                $enotif = new EmailNotification();
                                $enotif->notifyOnPageChange( $editor, $pageTitle,
                                        $commentDate,
                                        "New Comment Added",
                                        false );
                        }
                }
                // End of new code
                wfRunHooks( 'Comment::add', array( $this, $commentId, $this->PageID ) );
For MediaWiki 1.25 and Comments 4.1.0 --Jaccogeul (talk) 21:10, 13 November 2015 (UTC)
a) to CommentClass.php add:
                // Add a log entry.
                $pageTitle = Title::newFromID( $page->id );

                // BEGIN - Enable Comment Notifications 
                global $wgUseEnotif, $wgShowUpdatedMarker;
                if( $wgUseEnotif || $wgShowUpdatedMarker ) {
                        if ( Hooks::run( 'AbortEmailNotification', array( $user, $pageTitle ) ) ){
                                $enotif = new EmailNotification();
                                $enotif->notifyOnPageChange( $user, $pageTitle, $commentDate, "New Comment Added", false );
                        }
                }
                // END - Enable Comment Notifications

                $logEntry = new ManualLogEntry( 'comments', 'add' );
b) to CommentsPage.php add (location not important)
        // BEGIN - Enable Comment Notifications 
        /**
         * Get the namespace index, i.e. one of the NS_xxxx constants.
         *
         * @return int Namespace index
         */
        public function getNamespace() {
                return NS_MAIN;
        }
        // END - Enable Comment Notifications
This tweak works great (tested with MW 1.25.1 and Comments 4.02). I'm looking for a way to notify a single email address for all comments (without having to watch the page). Or maybe it would be better to just create a bot account to watch all pages. Any suggestions? Potrod (talk) 23:06, 22 April 2016 (UTC)

Our version[edit]

With email notification, recaptcha, threaded comments, preview and blah blah blah. —The preceding unsigned comment was added by Mopec (talkcontribs

Very nice! Is the source code available somewhere? Many of those features would be very useful to have integrated into the mainline codebase. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
I agree, it would be very helpful to know how you incorporated email notification, etc. Thanks and great work. Clifford.kasper (talk) 17:32, 10 July 2014 (UTC)

RU translation[edit]

$messages['ru'] = array(
	'comments-comment' => 'Comment',
	'comments-desc' => 'Добавляет парсеру поддержку тэга <code><comments></code>, позволяющего комментировать страницу',
	'comments-db-locked' => '<h3>Добавление комментариев</h3>В настоящий момент база данных заблокирована для технического обслуживания. Пожалуйста, попробуйте позже!',
	'comments-voted-label' => 'Голос учтён',
	'comments-loading' => 'Загрузка...',
	'comments-auto-refresher-enable' => 'Включить автопоказ новых комментариев',
	'comments-auto-refresher-pause' => 'Приостановить автопоказ новых комментариев',
	'comments-reply-to' => 'Ответ участнику',
	'comments-cancel-reply' => 'Отмена',
	'comments-block-warning-anon' => 'Вы уверены, что хотите игнорировать все комментарии от данного участника (его IP-адреса)?',
	'comments-block-warning-user' => 'Вы уверены, что хотите игнорировать все комментарии от участника $1?',
	'comments-delete-warning' => 'Вы уверены, что хотите удалить этот комментарий?',
	'comments-sort-by-date' => 'Сортировка по дате',
	'comments-sort-by-score' => 'Сортировка по оценке',
	'comments-show-comment-link' => 'Показать комментарий',
	'comments-manage-blocklist-link' => 'Управление списком заблокированных',
	'comments-ignore-message' => 'Вы игнорируете автора данного комментария',
	'comments-you' => 'Ваш',
	'comments-reply' => 'Ответить',
	'comments-login-required' => 'Необходимо представиться, чтобы оставить комментарий.',
	'comments-not-allowed' => 'Вам не хватает прав для отправки комментария.',
	'comments-post' => 'Добавить комментарий',
	'comments-submit' => 'Добавить комментарий',
	'comments-score-text' => 'Оценка',
	'comments-permalink' => 'Ссылка',
	'comments-delete-link' => 'Удалить комментарий',
	'comments-anon-name' => 'Непредставившийся участник',
	'comments-anon-message' => 'На сайте {{SITENAME}} комментарии можно оставлять <b>всем</b>. Если Вы не хотите оставаться анонимным, <a href="$1">зарегистрируйтесь</a> или <a href="$2">представьтесь</a>. Это бесплатно.',
	'comments-ignore-item' => '<a href="$1">$2</a> on $3 <a href="$4">(unblock)</a>',
	'comments-ignore-no-users' => 'В настоящий момент нет игнорируемых участников.',
	'comments-ignore-remove-message' => 'Вы уверены, что хотите перестать игнорировать комментарии участника <b>$1</b>?',
	'comments-ignore-unblock' => 'Разблокировать',
	'comments-ignore-cancel' => 'Отмена',
	'comments-ignore-title' => 'Список игнорируемых участников',
	'commentignorelist' => 'Список игнорируемых участников',
	'comments-no-comments-of-day' => 'Комментария дня сегодня нет.', // for the <commentsoftheday/> parser hook
	'commentslogpage' => 'Лог комментариев',
	'commentslogpagetext' => 'Лог комментариев.',
	'commentslogentry' => '', # For compatibility, don't translate this
	'commentslog-create-entry' => 'Новый комментарий',
	'comments-create-text' => '[[$1]] - $2', # Don't translate this
	'comments-time-ago' => '$1 назад',
	'comments-time-days' => '{{PLURAL:$1|один день|$1 дня|$1 дней}}',
	'comments-time-hours' => '{{PLURAL:$1|один час|$1 часа|$1 часов}}',
	'comments-time-minutes' => '{{PLURAL:$1|одну минуту|$1 минуты|$1 минут}}',
	'comments-time-seconds' => '{{PLURAL:$1|одну секунду|$1 секунды|$1 секунд}}',
	'log-show-hide-comments' => 'Лог комментариев $1', // For Special:Log
	// For Special:ListUsers - new commentadmin group
	'group-commentadmin' => 'Модераторы комментариев',
	'group-commentadmin-member' => '{{GENDER:$1|Модератор комментариев}}',
	'grouppage-commentadmin' => '{{SITENAME}}:Модератор комментариев',
	// For Special:ListGroupRights
	'right-comment' => 'Комментировать',
	'right-commentadmin' => 'Модерировать комментарии',
);

-- Vlsergey (talk) 21:12, 20 December 2012 (UTC)

Hi Vlsergey and thank you for the translation. By now, Comments extension — like the MediaWiki core software and numerous other extensions — is using translatewiki.net for internationalization (i18n) and localization (l10n), so you should sign up there in order to translate untranslated extensions and improve existing translations. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
This pural forms is invalid (and Git master too). Mediawiki implements only 3 pural forms. And the same pural form for 1, 21, 31, 41...(singular form) should be:
	'comments-time-days' => '{{PLURAL:$1|$1 день|$1 дня|$1 дней}}',
	'comments-time-hours' => '{{PLURAL:$1|$1 час|$1 часа|$1 часов}}',
	'comments-time-minutes' => '{{PLURAL:$1|$1 минуту|$1 минуты|$1 минут}}',
	'comments-time-seconds' => '{{PLURAL:$1|$1 секунду|$1 секунды|$1 секунд}}',
--SimonLitt (talk) 19:55, 7 November 2013 (UTC)

Add comments log to Recent Changes[edit]

How exactly can I make the comments log appear in the Recent Changes, so users don't have to go to Special:Logs? --GeorgeBarnick (talk) 22:42, 1 March 2013 (UTC)

Extension:Comments#Parameters --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
I added the $wgCommentsInRecentChanges = true; code to LocalSetting.PHP file, but it is not working. My SpecialChanges is index.php?title=Speciális:Friss_változtatások, because I installed MediaWiki with Hungarian languages.
Atomjani (talk) 06:49, 10 December 2013 (UTC)

Voting for anonymous users[edit]

Extension works great, but voting seems to require users to be logged in while commenting is allowed to everyone (default right). How can we change this? Can we use a voting right as we do with the comment one setting for example:

$wgGroupPermissions['*']['votecomments'] = true;

Maybe just an ip check could be enough to avoid self voting or spamming votes. Tank you --Federicodip (talk) 11:28, 5 May 2013 (UTC)

database not updating[edit]

Possibly I am missing something, but I receive the following error when attempting to use the extension comments:

Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "Comment::getCommentList". Database returned error "1146: Table 'cre1323108561357.mw_Comments' doesn't exist (cre1323108561357.db.11635546.hostedresource.com)".

I have tried the install on two different instances and both produce the same error. Yes, I ran update.php with no errors. It simple appears not to be update the database. I looked at the schema and confirmed the new tables are not present.

Please advise. —The preceding unsigned comment was added by Mp29885 (talkcontribs


I am also having this problem.

Any help would be great.

Thanks —The preceding unsigned comment was added by 110.22.53.0 (talkcontribs

Update your copy of the Comments extension and rerun update.php — older versions (which also lacked the update.php support) did not have support for $wgDBprefix (the database prefix). In any case, if possible, I'd recommend getting rid of the database prefix in the long run, it's more problematic than anything else in my opinion. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
Thank you Jack, that worked for me. I installed the latest stable version and it's working on my MW 1.19. MikeDarling (talk) 01:20, 14 March 2014 (UTC)

My corrections and suggestions[edit]

If there are very much comments (they can be added by spam bots), the error may occur due to long-running script.

Fatal error: Maximum execution time of xxx seconds exceeded

To fix this, need to limit the number of simultaneously displayed comments and add a pager. I implemented it, you can download the my version of the extension from the following page: http://coding.bezslabostei.ru/File:Comments-mw1.21_my-20130828.zip (also there are diff files at the achive).

I also suggest:

  • То spam protection is necessary check the input text for links. Further action will depend on the user's rights.
  • If the user don't have a permission to bypass a check, that should be displayed Captcha.
  • If the user don't have a permission to bypass the pre-moderation, the comment should not appear until it will be approved by the administrator.

--SimonLitt (talk) 21:48, 28 August 2013 (UTC)

Hi SimonLitt and thank you for the patch! I recall reviewing this earlier on, and while the code itself was mostly issue-free and the only "problems" I could find were very minor code style nitpicks, the main issue I had with it was the lack of AJAX. Comments uses JavaScript and AJAXy things extensively (whether that's a good or a bad thing is a different debate...) but since your code generates "normal" links, clicking on the pagination links causes the entire page to be reloaded. This not only breaks the "look and feel" of the extension, but it's rather inconvenient for the end-user.
That being said, you're absolutely right — Comments needs proper pagination, it needs anti-spam measures and moderation queue would be also very useful to have. While I don't have the time to work on all of those myself, I'd be happy to assist you and/or any and all other developers who feel like tackling these issues to the best extent of my abilities. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
Now I implement fully AJAXy pager. And fix a loop error (thanks うー). You can download the my version of the extension from the following page: http://coding.bezslabostei.ru/%D0%A4%D0%B0%D0%B9%D0%BB:Comments-d6e0307-my20131107.zip --SimonLitt (talk) 19:01, 7 November 2013 (UTC)
Hi again Simon and my apologies for the delay in reviewing your patch! I cleaned it up a bit and submitted to the repository as gerrit:99632. Thanks again for your contributions, I'm sure many users will like the new features you added. :-) --Jack Phoenix (Contact) 11:33, 6 December 2013 (UTC)
It's been 4 years. Is this implemented in the latest version now? from the above it sounds stable. --Anrake (talk) 11:38, 6 July 2017 (UTC)

Theoretical bug[edit]

Hello,

Jack Phoenix helped me with a problem over at the MediaWiki Support Desk, and he referred me to the source code for this extension as guidance in writing my own. I have written a JavaScript function that was modeled on your toggleLiveComments function in Comment.js. In the process of testing my function, I discovered a bug that manifested in my extension, and I suspect it would in yours as well. I have never used your extension or tested this, so this may only be a potential bug. :-)

Here is an excerpt of what I wrote over at the Support Desk:

I've used the toggleLiveComments function as a model for my own. I found that if I click the toggle link [in my own extension] several times (>10), the toggling takes longer and longer, roughly twice as long each time. Quickly, this brings my browser to its knees.

The problem is that each time the toggleLiveComments function is called, a new jQuery event handler is created using .on. It is appended to the list of existing event handlers. So, for each click, JavaScript is executing toggleLiveComments(1); toggleLiveComments(0); toggleLiveComments(1); toggleLiveComments(0); toggleLiveComments(1); ..., etc., and this list doubles in length with each click.

One way to fix this is to use .one instead of .on in these two lines of code: [1] [2]. Although, since [the Comments] extension is using jQuery( 'body' ).on instead of jQuery( 'a.some-custom-class' ).on and there are other on-click events associated with body, you may need to use .off in combination with .on instead (see the example here).

I hope you find this helpful!

--Jpgill86 (talk) 15:35, 27 September 2013 (UTC)

Hi Jpgill86 and thanks for the detailed report! Talk about a rather obscure bug! I haven't tested that part of the Comments extension extensively, but I'll try to find some time for that and apply your suggested fixed. But in case if I forget, you're more than welcome to apply for developer access and submit a patch on gerrit (and add me as a reviewer for the changeset). --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)

Git Snapshot for 1.20[edit]

Just a heads up. The Git snapshot downloader for version 1.20 downloads an old version - revision 9807f3c (2012-11-04). The most recent major change (as of this comment) is d8f84d4 (2013-07-28), which is compatible with 1.19+, and includes compatability with maintenance/update.php 03swalker (talk) 10:12, 1 October 2013 (UTC)

loop comments[edit]

<comments> - If add this text in the comment. Comments extension has loop message.

Proposal[edit]

	public static function displayComments( $input, $args, $parser ) {
		global $wgOut;

		wfProfileIn( __METHOD__ );

		$parser->disableCache();

		// add this line
		$parser->setHook( 'comments', array( 'CommentsHooks', 'nonDisplayComments' ) );

		// Add required CSS & JS via ResourceLoader
		$wgOut->addModules( 'ext.comments' );

		// Parse arguments
		// The preg_match() lines here are to support the old-style way of
		// adding arguments:
		// <comments>
		// Allow=Foo,Bar
		// Voting=Plus
		// </comments>
		// whereas the normal, standard MediaWiki style, which this extension
		// also supports is: <comments allow="Foo,Bar" voting="Plus" />
		$allow = '';
		if( preg_match( '/^\s*Allow\s*=\s*(.*)/mi', $input, $matches ) ) {
			$allow = htmlspecialchars( $matches[1] );
		} elseif( !empty( $args['allow'] ) ) {
			$allow = $args['allow'];
		}

		$voting = '';
		if( preg_match( '/^\s*Voting\s*=\s*(.*)/mi', $input, $matches ) ) {
			$voting = htmlspecialchars( $matches[1] );
		} elseif(
			!empty( $args['voting'] ) &&
			in_array( strtoupper( $args['voting'] ), array( 'OFF', 'PLUS', 'MINUS' ) )
		)
		{
			$voting = $args['voting'];
		}

		$comment = new Comment( $wgOut->getTitle()->getArticleID() );
		$comment->setAllow( $allow );
		$comment->setVoting( $voting );

		// This was originally commented out, I don't know why.
		// Uncommented to prevent E_NOTICE.
		$output = $comment->displayOrderForm();

		$output .= '<div id="allcomments">' . $comment->display() . '</div>';

		// If the database is in read-only mode, display a message informing the
		// user about that, otherwise allow them to comment
		if( !wfReadOnly() ) {
			$output .= $comment->displayForm();
		} else {
			$output .= wfMessage( 'comments-db-locked' )->parse();
		}

		wfProfileOut( __METHOD__ );

		return $output;
	}
	// add this function
	public static function nonDisplayComments( $input, $args, $parser ) {
		return wfMessage('comments-error');
	}

—The preceding unsigned comment was added by うー (talkcontribs

Thank you for the patch. I'm not sure if this is the cleanest possible approach, but the issue you describe is a very real one and especially inexperienced users might stumble upon it, so fixing it would be very nice. I'll see if I can get a Parser guru somewhere to explain me the internals of parser hook processing and what's the proper way to handle these kind of edge cases. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
Is not full patch. When the comments loaded through ajax, the problem remains. --SimonLitt (talk) 15:08, 7 November 2013 (UTC)

Comments Extension Database error[edit]

I have installed Comments extension http://www.mediawiki.org/wiki/Extension:Comments ,i am using 1.21.2 version of mediawiki, i have updated the wiki ,when i have checked Special:Version it is there ,but when i have added <comments /> to the end of the page ,it is showing this error Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "Comment::getCommentList". Database returned error "1146: Table 'lriwiki.lriComments' doesn't exist (lriwiki.db.5278410.hostedresource.com)".

please help me with a slution,i have been stuck with this for 3 days, googling a lot —The preceding unsigned comment was added by Fazeela Abu Zohra (talkcontribs

You forgot to create the required database table, as described in the installation instructions (step #2). Make sure you have an up-to-date version of the Comments extension and then rerun maintenance/update.php. --Jack Phoenix (Contact) 13:06, 1 November 2013 (UTC)
I just installed this on the 1.25.2, but I keep getting this error and the tables were created in the SQL DB. Any ideas?

More level comment[edit]

I would more level comment. Example:

Comment1

Comment2
Comment4
Comment5
Comment6
Comment7
Comment3

How can I set this?

LiquidThreads may be more useful for you. Otherwise it'd require various hacks to the extension. --GeorgeBarnick (talk) 07:09, 10 December 2013 (UTC)

Disable avatar, reply and permalink; add delete for poster, sort by username[edit]

What's the best way to disable the display of avatar images, and the reply and permalink links?

I'd also like to be able to sort by username as well as date.

Lastly, I'd like to give the poster the ability to delete their comment.

Thanks! —The preceding unsigned comment was added by 216.16.230.210 (talkcontribs

There isn't a way to disable Comments' essential features. Why would there be?
For the other two feature requests, report a bug on Bugzilla. --Jack Phoenix (Contact) 19:05, 12 December 2013 (UTC)
As Jack said, those are essential features, but if you really wanted to and had some reason to, you could hide avatars and those different links through CSS by using display: none; on those elements in MediaWiki:Common.css. --GeorgeBarnick (talk) 19:59, 12 December 2013 (UTC)

Not showing IPs[edit]

On most blogs, commenters have a nickname and the IP is not exposed. I understand anonymous accounts IPs can't be hidden, even if blogs do this (show them as AnonymousUser), for the sake of wiki transparency. But would you be interested in implementing an easy way to register? Eg a comment box, and a nick+password thingie below it, sufficiently interactive for a comment to not get lost if the username already exists. --Gryllida 03:42, 2 February 2014 (UTC)

The only way I could come up with, regarding an implementation, was that of registering a AnonymousCommenter account across all wikis. This extension would log in as it and post for anons. It would log each such action onto a restricted special page where such anons can be blocked — from commenting, not from the wiki — by IP. --Gryllida 05:45, 8 February 2014 (UTC)

user right request[edit]

I just wanted to ask, while normally local staff is given the duty to monitor and moderate the community; it still feels wrong to take this away from the blog author. Google Blogger and WordPress both allow the author to moderate. Now, I understand that this may be difficult to do or could be considered by others to be less useful but it would seem logical to put in practice. If someone is willing to, could additional customization be added so that blog authors would be also given this user right?

I'd like to know this too. Vapblack (talk) 22:45, 7 May 2014 (UTC)

Block anonymous user[edit]

How block anonymous user from post comments?

API to add or get comments[edit]

Is it possible to get comments from api and add a new comment? I can't find that in api.php. I don't think it's a good way to read the database myself.

I need also this, could it be a new feature request? I just need to write a comment by API.

getTimeAgo Kills Map? #FOUND PROBLEM[edit]

First, I love the extension. Exactly what I was working for!

Strange problem though. When comment section is placed after a map, it completely kills the map from loading. I managed to trace the problem down to the ->parse on wfMessage. I changed them to ->text in commentclass.php, and all is working. Would love to hear from someone more knowledgeable if this is a good fix?

Delete own and limit per page[edit]

I was wondering if there was a way to allow users to delete or edit their own comments? Also, is there a way to limit a user to only 1 comment per page? Thanks

Comment box does not appear in multiple pages[edit]

I am unable to see the comment box in pages other than one page. Only I am able to find the following line instead:

<comments />

I am able to see the comment box in the page preview box. When I save the page, the box is gone & I find the "<comments /> " in the page end. Am I doing anything worng or is there any bug? I am using Mediwki version 1.23.2.

I have the same problem. Can someone help? :) --Gálaniitoluodda (talk) 11:48, 7 September 2014 (UTC)
I have solved this problem as follows:
In file LocalSettings.php
Line require_once "$ IP / extensions / Comments / Comment.php";
Raised up in the list of connected extensions.
Probably some other extensions prevent the "Comments" to display properly.
Sorry for my bad English.--Weshber (talk) 13:43, 17 February 2015 (UTC)

Comment box works, then mysteriously doesn't work, same problem as above I think[edit]

I have the same problem also. More details: Mediawiki 1.23.5 with standard packages (PHP 5.5.9, MySQL 5.5.38). It works on some pages but not others. For example, on my private wiki, it works on:

/wikifolder/index.php/User:Usersname

but not

/wikifolder/index.php/Microsoft_Team_Foundation_Server_(MTFS)

Could it have something to do with directory or page names? Oddly it has now stopped working on the page it was working on above. No change to the source. Here is the source

=Comments=
Put your comments here:
<comments />

I am seeing this in Chrome and IE on Windows 7. I will check the javascript now as mentioned above. Thanks for the extenstion, it is very cool. Kmacdowe (talk) 18:18, 18 November 2014 (UTC)

Even I have the same issue, the parser tag "<comments />" renders sometime and sometimes it won't, please share the fix soon. Harish

Adding Comments to all pages[edit]

Is there a way to enable comments on previously created pages (other than updating each page manually)? Also, to have them automatically enabled on future pages.

--MikeDarling (talk) 22:28, 14 January 2015 (UTC)

Bug with extension trying to work with SQLite[edit]

From what i've gathered SQLite doesn't seem to support the UNIX_TIMESTAMP function used in CommentClass.php. --Syco link (talk) 14:13, 7 April 2015 (UTC)

I had the same issue and ended up replacing 'UNIX_TIMESTAMP(Comment_Date) AS timestamp' with "strftime('%s',Comment_Date) AS timestamp" momentarily --hjp 12:54, 26 August 2015 (UTC)

Fatal Error in Category/Page with Comments Extension[edit]

Hi my friends.

Yesterday I have been working to fix an issue at my Wiki and finally after some tests I realize that is the Comments Extension that are breaking this.

After an user insert a new comment, or actually, more than one comment the category/page which user had insert the comment break with fatal error, this one:

Fatal error: Call to a member function getMaxIncludeSize() on null in C:\xampp\htdocs\wiki-hdti\includes\parser\Parser.php on line 3266

I don't know how to do to fix this. I need the comments extension. Maybe it's parsing all the content and that's why this are happening. Someone have one idea? I was looking for the tag maybe it's correct way?

Thanks until now.

Comment deleted, still in comment log[edit]

First, thanks for creating a comment system anyone can comment with on a wiki.

I just had a user ask me to delete his comment after he decided he didn't want his email there.

I have deleted it but noticed the comment is still there in the logs. I don't know how this affects other things but for this purpose, I'd like the log to be deleted too.

Latest Doesnt Work[edit]

If I download the master from the mediawiki extension page, the bug with the partially removed columns is still there.

If I download latest from git, the two deprecated columns have been fully removed but I get the following error:

Notice: Undefined offset: 0 in /extensions/Comments/CommentsPage.php on line 482

The Post Comment button doesn't do anything.

Using MW 1.25.1

Fractalfederation (talk) 15:33, 17 June 2015 (UTC)

Auto-refresh not working at all, sometimes you have to refresh page to get comments to display or in order to post another comment, Reply shows up with anonymous users are disabled, Delete shows up on Anonymous when enabled for another group, you can't reply to other people's commments, only your own.. seems experimental not stable.

Fractalfederation (talk) 15:33, 17 June 2015 (UTC)

You should probably file an actual bug report about this, see BUGREPORT. --Lcawte (talk) 10:46, 24 June 2015 (UTC)

Just downloaded and don't work[edit]

Just downloaded and don't work always gives database error even though the tables exist.

This may indicate a bug[edit]

I have installed Comments extension http://www.mediawiki.org/wiki/Extension:Comments ,but when i have added <comments /> to the end of the page ,it is showing this error Database error A database query syntax error has occurred. This may indicate a bug in the software.


MediaWiki Version: 1.25.1

Comments Version: 4.0.2

Php Version 5.6.10

MySql version: 5.5.43


Tables in DB:

mw_comments

mw_comments_block

mw_comments_vote



(O records)


Instalation: Copy files to /www/extensions/Comments Add in LocalSettings.php > require_once "$IP/extensions/Comments/Comments.php"; run Update.php,


(... ...Comments table already exists.

...Comments_Vote table already exists.

...Comments_block table already exists.

...) Second time


can someone help me please?

Url: http://www.smitepedia.com.br/index.php?title=Especial:Vers%C3%A3o — Preceding unsigned comment added by TioWidow (talkcontribs) 18:30, 22 July 2015

@TioWidow: Enable SQL error reporting (see Manual:How to debug#SQL errors) and then paste the actual SQL error info here and I'll be able to help you out more (hopefully). --Jack Phoenix (Contact) 17:15, 22 July 2015 (UTC)



@Jack Phoenix:

QUERY


SELECT Comment_Username,Comment_IP,Comment_Text,Comment_Date,UNIX_TIMESTAMP(Comment_Date) AS timestamp,Comment_user_id,CommentID,IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score,Comment_Parent_ID,CommentID,Comment_Plus_Count AS CommentVotePlus,Comment_Minus_Count AS CommentVoteMinus,stats_total_points FROM `mw_user_stats` LEFT JOIN `mw_Comments` ON ((Comment_user_id = stats_user_id)) WHERE Comment_Page_ID = '1735' LIMIT 100


Function:

CommentsPage::getCommentList


Error: 1054 Column 'Comment_Plus_Count' unknown in 'field list' (mysql.smitepedia.com.br)

— Preceding unsigned comment added by TioWidow (talkcontribs) 23:16, 22 July 2015‎

@TioWidow: This sounds like phabricator:T98550, which was fixed about two months ago. Can you try getting the latest versions of Comments, please? You can download it via Special:ExtensionDistributor, for example — make sure to pick "master (latest development version)" instead of any branched version, like 1.25 or 1.24 (the branched versions are arbitrarily generated whenever a new major version of MediaWiki is released and I don't maintain those branches, so they are likely to be outdated and buggy; the only combination that I'm able to support is master version of this extension + latest stable version of MW). --Jack Phoenix (Contact) 12:38, 23 July 2015 (UTC)
Thanks @Jack Phoenix, I did as you suggested, and it works like a charm! Bennylin (talk)
Also, rearranged the next section as subsection

Missing columns[edit]

Hello, When I had <comments /> on a page, it kept displaying a database error, even after the update script. So I displayed the sql error and saw that there were two missing columns : Comment_Plus_Count and Comment_Minus_Count. These are not in the sql files included in the extension package, and not added with the update.php script. Cordialy, Steranoid — Preceding unsigned comment added by Steranoid (talkcontribs) 14:11, 24 July 2015‎

@Steranoid: Please upgrade your copy of Comments to the latest (master/development) version; the issue you're describing is phabricator:T98550, which was fixed about two months ago. Please let me know whether upgrading solves this issue or not. --Jack Phoenix (Contact) 13:41, 24 July 2015 (UTC)

Making Extension work with mediawiki 1.23 + Mobile Frontend Extension[edit]

First edit Comment.php and make the module mobile friendly, append this code at the end of Comment.php

//enabling module for mobile version

$wgResourceModules['ext.comments.mobile'] = $wgResourceModules['ext.comments'] + array(
	'targets' => 'mobile',
);

function efEnableMobileModules( $out, $mode ) {
	$name = 'ext.comments.mobile';
	$out->addModules( $name );
	return true;
}

$wgHooks['EnableMobileModules'][] =  "efEnableMobileModules";

//enabling module for mobile version ends.


Not only this, the extension uses the deprecated sajax_do_call which should not be used, you can replace the code in comment.js with following code, for the reference I have only commented out the old code, However this works well with the desktop version of wiki, but with MobileFrontend this will halt your comments extension.(Please be warned it is tested on the version 1.23.9LTS if you are using version above try to use original Comments extension without code modification).

/**
 * JavaScript for the Comments extension.
 * Rewritten by Jack Phoenix <jack@countervandalism.net> to be more
 * object-oriented.
 *
 * @file
 * @date 28 July 2013
 */
var Comment = {
	submitted: 0,
	isBusy: false,
	timer: '', // has to have an initial value...
	updateDelay: 7000,
	LatestCommentID: '',
	CurLatestCommentID: '',
	pause: 0,

	/**
	 * When a comment's author is ignored, "Show Comment" link will be
	 * presented to the user.
	 * If the user clicks on it, this function is called to show the hidden
	 * comment.
	 */
	show: function( id ) {
		jQuery( '#ignore-' + id ).hide( 100 );
		jQuery( '#comment-' + id ).show( 500 );
	},

	/**
	 * This function is called whenever a user clicks on the "block" image to
	 * block another user's comments.
	 *
	 * @param user_name String: name of the user whose comments we want to block
	 * @param user_id Integer: user ID number of the user whose comments we
	 *                         want to block (or 0 for anonymous users)
	 * @param c_id Integer: comment ID number
	 */
	blockUser: function( user_name, user_id, c_id ) {
		var message;
		var token = document.commentform.token.value;

		// Display a different message depending on whether we're blocking an
		// anonymous user or a registered one.
		// We could check if user_name is an IP with mw.util.isIPv4Address and
		// mw.util.isIPv6Address, but that'd be overkill since we know that all
		// anons have id = 0 in MediaWiki and we expose the user ID via HTML to
		// this function, so...
		if ( !user_id || user_id === 0 ) {
			message = mw.msg( 'comments-block-warning-anon' );
		} else {
			message = mw.msg( 'comments-block-warning-user', user_name );
		}

		if ( confirm( message ) ) {
			$.ajax({
					type:'POST',
					url:mw.util.wikiScript(),
					data:{
						action:'ajax',
						rs:'wfCommentBlock',
						rsargs:[ c_id, user_id, token ]
					},
					success:function( response ) {
						jQuery( '#comment-' + c_id ).hide( 2000 );
						//alert( response.responseText );
						//window.location.href = window.location;
					}
			});
			
			/*sajax_request_type = 'POST';
			sajax_do_call( 'wfCommentBlock', [ c_id, user_id, token ], function( response ) {
				jQuery( '#comment-' + c_id ).hide( 2000 );
				//alert( response.responseText );
				//window.location.href = window.location;
			});*/
		}
	},

	/**
	 * This function is called whenever a user clicks on the "Delete Comment"
	 * link to delete a comment.
	 *
	 * @param c_id Integer: comment ID number
	 */
	deleteComment: function( c_id ) {
		var pageId = document.commentform.pid.value,
			token = document.commentform.token.value;
		if ( confirm( mw.msg( 'comments-delete-warning' ) ) ) {
			$.ajax({
					type:'POST',
					url:mw.util.wikiScript(),
					data:{
						action:'ajax',
						rs:'wfDeleteComment',
						rsargs:[ pageId, c_id, token ]
					},
					success:function( response ) {
						// The commented-out line is original code. I have no clue what
						// it was supposed to do, but the jQuery gimmick below looks
						// better, IMHO.
						//window.location.href = window.location;
						jQuery( '#comment-' + c_id ).hide( 2000 );
					}
			});

			/*sajax_request_type = 'POST';
			sajax_do_call( 'wfDeleteComment', [ pageId, c_id, token ], function( response ) {
				// The commented-out line is original code. I have no clue what
				// it was supposed to do, but the jQuery gimmick below looks
				// better, IMHO.
				//window.location.href = window.location;
				jQuery( '#comment-' + c_id ).hide( 2000 );
			});*/
		}
	},

	/**
	 * Vote for a comment.
	 * Formerly called "cv"
	 *
	 * @param cid Integer: comment ID number
	 * @param vt Integer: vote value
	 * @param vg
	 */
	vote: function( cid, vt, vg ) {
		var pageID = document.commentform.pid.value,
		token = document.commentform.token.value;
		$.ajax({
				type:'POST',
				url:mw.util.wikiScript(),
				data:{
					action:'ajax',
					rs:'wfCommentVote',
					rsargs:[ cid, vt, ( ( vg ) ? vg : 0 ), pageID, token ]
				},
				success:function( response ) {
					document.getElementById( 'Comment' + cid ).innerHTML = response.responseText;
					var img = '<img src="' + mw.config.get( 'wgExtensionAssetsPath' ) + '/Comments/images/voted.gif" alt="" />';
					document.getElementById( 'CommentBtn' + cid ).innerHTML = img + '<span class="CommentVoted">' + mw.msg( 'comments-voted-label' ) + '</span>';
				}
			});

		/*sajax_request_type = 'POST';
		sajax_do_call(
			'wfCommentVote',
			[ cid, vt, ( ( vg ) ? vg : 0 ), pageID, token ],
			function( response ) {
				document.getElementById( 'Comment' + cid ).innerHTML = response.responseText;
				var img = '<img src="' + mw.config.get( 'wgExtensionAssetsPath' ) + '/Comments/images/voted.gif" alt="" />';
				document.getElementById( 'CommentBtn' + cid ).innerHTML =
					img + '<span class="CommentVoted">' +
					mw.msg( 'comments-voted-label' ) + '</span>';
			}
		);*/
	},

	/**
	 * This is ugly but we have to use this because AJAX function wfCommentList
	 * doesn't work...thanks, Parser.php
	 *
	 * @param pid Integer: page ID
	 * @param ord Sorting order
	 * @param end
	 */
	viewComments: function( pid, ord, end ) {
		document.getElementById( 'allcomments' ).innerHTML = mw.msg( 'comments-loading' ) + '<br /><br />';
		var ajaxurl = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/index.php?title=Special:CommentListGet&pid=' + pid + '&ord=' + ord;

		$.ajax({
				type:'GET',
				url:ajaxurl,
				success:function( response ) {
					document.getElementById( 'allcomments' ).innerHTML = response;
					Comment.submitted = 0;
					if ( end ) {
						window.location.hash = 'end';
					}
				}
			});
/*
		var x = sajax_init_object();

		x.open( 'get', url, true );

		x.onreadystatechange = function() {
			if ( x.readyState != 4 ) {
				return;
			}

			document.getElementById( 'allcomments' ).innerHTML = x.responseText;
			Comment.submitted = 0;
			if ( end ) {
				window.location.hash = 'end';
			}
		};

		x.send( null );*/
	},

	/**
	 * Submit a new comment.
	 */
	submit: function() {
		if ( Comment.submitted === 0 ) {
			Comment.submitted = 1;

			var pidVal = document.commentform.pid.value;
			var parentId;
			if ( !document.commentform.comment_parent_id.value ) {
				parentId = 0;
			} else {
				parentId = document.commentform.comment_parent_id.value;
			}
			var commentText = document.commentform.comment_text.value;
			var token = document.commentform.token.value;

			$.ajax({
				type:'POST',
				url:mw.util.wikiScript(),
				data:{
					action:'ajax',
					rs:'wfCommentSubmit',
					rsargs:[ pidVal, parentId, commentText, token ]
				},
				success:function( response ) {
					document.commentform.comment_text.value = '';
					Comment.viewComments( document.commentform.pid.value, 0, 1 );
				}
			});

			/*sajax_request_type = 'POST';
			sajax_do_call(
				'wfCommentSubmit',
				[ pidVal, parentId, commentText, token ],
				function( response ) {
					document.commentform.comment_text.value = '';
					Comment.viewComments( document.commentform.pid.value, 0, 1 );
				}
			);*/
			Comment.cancelReply();
		}
	},

	/**
	 * Toggle comment auto-refreshing on or off
	 *
	 * @param status
	 */
	toggleLiveComments: function( status ) {
		if ( status ) {
			Comment.pause = 0;
		} else {
			Comment.pause = 1;
		}
		var msg;
		if ( status ) {
			msg = mw.msg( 'comments-auto-refresher-pause' );
		} else {
			msg = mw.msg( 'comments-auto-refresher-enable' );
		}

		jQuery( 'body' ).on( 'click', 'div#spy a', function() {
			Comment.toggleLiveComments( ( status ) ? 0 : 1 );
		} );
		jQuery( 'div#spy a' ).css( 'font-size', '10px' ).text( msg );

		if ( !Comment.pause ) {
			Comment.LatestCommentID = document.commentform.lastcommentid.value;
			Comment.timer = setTimeout(
				function() { Comment.checkUpdate(); },
				Comment.updateDelay
			);
		}
	},

	checkUpdate: function() {
		if ( Comment.isBusy ) {
			return;
		}
		var pid = document.commentform.pid.value;
			$.ajax({
				type:'GET',
				url:mw.util.wikiScript(),
				data:{
					action:'ajax',
					rs:'wfCommentLatestID',
					rsargs:[ pid ]
				},
				success:function( response ) {
					Comment.updateResults( response );
				}
			});

		/*sajax_do_call( 'wfCommentLatestID', [ pid ], function( response ) {
			Comment.updateResults( response );
		});*/
		Comment.isBusy = true;
		return false;
	},

	updateResults: function( response ) {
		if ( !response || response.readyState != 4 ) {
			return;
		}

		if ( response.status == 200 ) {
			// Get last new ID
			Comment.CurLatestCommentID = response.responseText;
			if ( Comment.CurLatestCommentID != Comment.LatestCommentID ) {
				Comment.viewComments( document.commentform.pid.value, 0, 1 );
				Comment.LatestCommentID = Comment.CurLatestCommentID;
			}
		}

		Comment.isBusy = false;
		if ( !Comment.pause ) {
			clearTimeout( Comment.timer );
			Comment.timer = setTimeout(
				function() { Comment.checkUpdate(); },
				Comment.updateDelay
			);
		}
	},

	/**
	 * Show the "reply to user X" form
	 *
	 * @param parentId Integer: parent comment (the one we're replying to) ID
	 * @param poster String: name of the person whom we're replying to
	 */
	reply: function( parentId, poster ) {
		jQuery( '#replyto' ).text(
			mw.msg( 'comments-reply-to' ) + ' ' + poster + ' ('
		);
		jQuery( '<a>', {
			href: 'javascript:void(0);',
			'class': 'comments-cancel-reply-link',
			text: mw.msg( 'comments-cancel-reply' )
		} ).appendTo( '#replyto' );
		jQuery( '#replyto' ).append( ') <br />' );

		document.commentform.comment_parent_id.value = parentId;
	},

	cancelReply: function() {
		document.getElementById( 'replyto' ).innerHTML = '';
		document.commentform.comment_parent_id.value = '';
	}
};

jQuery( document ).ready( function() {
	// Important note: these are all using jQuery( 'body' ) as the selector
	// instead of the class/ID/whatever so that they work after viewComments()
	// has been called (i.e. so that "Delete comment", reply, etc. links
	// continue working after you've submitted a comment yourself)

	// "Sort by X" feature
	jQuery( 'body' ).on( 'change', 'select[name="TheOrder"]', function() {
		Comment.viewComments(
			mw.config.get( 'wgArticleId' ), // or we could use jQuery( 'input[name="pid"]' ).val(), too
			jQuery( this ).val()
		);
	} );

	// Comment auto-refresher
	jQuery( 'body' ).on( 'click', 'div#spy a', function() {
		Comment.toggleLiveComments( 1 );
	} );

	// Voting links
	jQuery( 'body' ).on( 'click', 'a#comment-vote-link', function() {
		var that = jQuery( this );
		Comment.vote(
			that.data( 'comment-id' ),
			that.data( 'vote-type' ),
			that.data( 'voting' )
		);
	} );

	// "Block this user" links
	jQuery( 'body' ).on( 'click', 'a.comments-block-user', function() {
		var that = jQuery( this );
		Comment.blockUser(
			that.data( 'comments-safe-username' ),
			that.data( 'comments-user-id' ),
			that.data( 'comments-comment-id' )
		);
	} );

	// "Delete Comment" links
	jQuery( 'body' ).on( 'click', 'a.comment-delete-link', function() {
		Comment.deleteComment( jQuery( this ).data( 'comment-id' ) );
	} );

	// "Show this hidden comment" -- comments made by people on the user's
	// personal block list
	jQuery( 'body' ).on( 'click', 'div.c-ignored-links a', function() {
		Comment.show( jQuery( this ).data( 'comment-id' ) );
	} );

	// Reply links
	jQuery( 'body' ).on( 'click', 'a.comments-reply-to', function() {
		Comment.reply(
			jQuery( this ).data( 'comment-id' ),
			jQuery( this ).data( 'comments-safe-username' )
		);
	} );

	// "Reply to <username>" links
	jQuery( 'body' ).on( 'click', 'a.comments-cancel-reply-link', function() {
		Comment.cancelReply();
	} );

	// Handle clicks on the submit button (previously this was an onclick attr)
	jQuery( 'body' ).on( 'click', 'div.c-form-button input[type="button"]', function() {
		Comment.submit();
	} );
} );

Tiwari.mayank24 (talk) 07:05, 27 July 2015 (UTC)

@Tiwari.mayank24: You should update your MediaWiki to the latest stable release of MediaWiki (1.25 branch at the time of writing); any and all other versions of MediaWiki are unsupported (by me), and social tools are guaranteed to work with and have been tested against the latest stable version. I appreciate you taking the time to not only prepare this patch, but to post it here too, but we'll want to encourage users to use a supported, stable setup instead of using old versions.
That being said, I'm glad to see that someone has an interest on social tools on mobile platforms! Alas, I regrettably have very little experience with MobileFrontend, but I'm currently working on making the Vector skin more responsive (see phabricator:T106463), which will provide a mobile-friendly view of the site even when MobileFrontend isn't available. As a part of this work, I've been testing the various social tools against the skin and fixing issues as I've spotted them. If you're interested in this, you can see both the responsive version of Vector as well as my CSS fixes for various social tools in action on my Labs test wiki. I've yet to commit these CSS fixes to the appropriate source repositories, given that I'm still testing out them, but I expect that by the end of August social tools will be far more responsive and usable on mobile devices. ;-) Comments, suggestions and other feedback is always more than welcome! --Jack Phoenix (Contact) 21:00, 28 July 2015 (UTC)
@Jack Phoenix: Thank you, I appreciate you providing the suggestion, but I have met some users who use shared hosting or possibly don't have any kind of technical knowledge for upgrading or may be they just wouldn't like to upgrade from any LTS version, for example When I created this patch I was working on 1.23.9 LTS(LTS are long term supported version) so instead of current stable release persnally I prefer long term stable version. Hope this will help someone like me who might be seeking help for this perticular version. And just for the Note, I did looked at the extension version for latest stable release and that gave me Idea of this patch. :) Tiwari.mayank24 (talk) 06:21, 31 July 2015 (UTC)

Request: "novotes" or votes="off" option[edit]

I can forsee a scenario where you might want to completely disable voting in a comments section. E.g. If you use comments for a "Guestbook" It would be nice to have the option to turn the votes "off" in this instance

Thanks, --BradLeeBH (talk) 08:19, 15 September 2015 (UTC)

REQ: Disable ignore comments[edit]

Can you please add an option in LocalSettings.php to disable comments ignore?

Thanks, --BradLeeBH (talk) 08:49, 15 September 2015 (UTC)

A very simple workaround is to delete (or rename) extensions/Comments/block.svg from your system. --145.94.54.6 16:31, 13 November 2015 (UTC)
That doesn't work for Chrome users, as the placeholder for the deleted image is still displayed. Same with newer versions of Firefox. --BradLeeBH (talk) 23:58, 11 May 2017 (UTC)

Feature request[edit]

Please allow registered users to edit their comments, which is currently not possible. Cavila 11:38, 23 September 2015 (UTC)

Something like "Show More" for long series of comments?[edit]

So far I have to say this is a great and simple-to-use extension (thanks!). In forethought of employing it, I thought I might run into some user experience issues if any page was populated by a heavy number of comments. In such a case, the user would (as I see it) have to scroll aaaaalllll the way down to the bottom to reach the comment box.

Any thoughts on addressing this? I think the most common thing I see is to cap off the display to a certain number and allow the user to cycle through more pages, but honestly, I think a temporary fix of even having a link down to the comment box could work until such a matter was developed. Joshkking (talk) 04:43, 28 November 2015 (UTC)

Documentation about the avatar in the comments?[edit]

It seems to me that the social profile extension is required to make sense of how the avatar is included in each of the comments. Should this be included in the documentation here, or is there some other way for users to alter their avatar which I am missing?

If there's not, it might be worth making a note of using CSS and display to crank those elements off in case users (likely such as myself) want to use this extension stand-alone. Joshkking (talk) 04:47, 28 November 2015 (UTC)

Sementify Comments extension[edit]

As the SemanticComments extension is rather unmaintained and your extension is very nice, I'd like to see the feature that the comments are stored using Semantic MediaWiki (if it is present). I guess this is not a very complex task, is anybody interested in implementing this (see SemanticComments extension for its current features). Krabina (talk) 15:38, 11 December 2015 (UTC)

User Rights[edit]

I'm trying to limit comment addition to registered users, and as per the documentation have the following line after the require_once in LocalSettings:

$wgGroupPermissions['user']['comment'] = true;

Yet my wiki is still allowing anonymous comments. Anyone run into this?

Rozzingit (talk) 18:09, 21 December 2015 (UTC)

Fix For User Rights[edit]

I fixed it by preventing anyone from commenting with

$wgGroupPermissions['*']['comment'] = false;

then adding commenting rights for users

$wgGroupPermissions['user']['comment'] = true;

Problems when used with Header Footer extension[edit]

Hey guys, I'm seeking a little help implementing this extension on my wiki, lostmediawiki.com. If I manually put the <comments /> tag in an article's code, it works fine, but if I use the Header Footer extension to have it put said code on every page, the code for the post's time displays like this: '{{PLURAL:13|one hour|13 hours}} {{PLURAL:14|one minute|14 minutes}}' instead of '13 hours 14 minutes'. The site's name also doesn't display properly when an anonymous visit browses the page, instead showing '{{SITENAME}} welcomes all comments. If you do not want to be anonymous, register or log in. It is free.' Do any of you guys know what might be causing this?

One other issue I've been running into is that, while using the current setup as described above, if an article is edited after a comment has been posted on it, it gives the error message 'Fatal error: Call to a member function getMaxIncludeSize() on a non-object in /home/wiki/public_html/includes/parser/Parser.php on line 3139'. The only method of remedying this that I have come across is adding '$wgEnableParserCache = false;' to LocalSettings.php, but this, as I've been told, can slow the site down.

I'm still very much a novice when it comes to MediaWiki and I'd be really grateful to anyone who could point me in the right direction; cheers.

Dycaite (talk) 10:44, 19 February 2016 (UTC)

Issue when using comments and side-by-side preview[edit]

I am running:

MediaWiki: 1.26.2

PHP 5.6.15

MariaDB 10.1.9

After creating or editing a npage, if you add the <comments /> tag anywhere on the page, then preview the changes using the side-by-side preview button, then use the "Save Page" button, none of your changes will be saved. Has anyone else ran into this issue and has figure out a solution for it?

Thank you for any help you might be able to give.

Mikestuart09 (talk) 19:28, 15 March 2016 (UTC)

Notifications if someone answers your comment[edit]

Is there a way to enable Notifications, like when someones writes on your User Talk page, when someone answers to your comment?

Related: https://phabricator.wikimedia.org/T64520 --GeorgeBarnick (talk) 20:39, 18 April 2016 (UTC)

I am also looking forward for such a tool, if you have news please tell me :) Tuxxic (talk) 12:35, 5 October 2016 (UTC)

How can I add comments in all Discussion Talk Pages?[edit]

I want to add comments to all Talk pages. I'm sure I can do that via PHP. Anybody knows how? Thank you

Me too. Theres gotta be a way to do this with a hook, but i'm not that good yet to code it --Steveengelhardt (talk) 01:36, 27 May 2017 (UTC)

New features[edit]

Is it possible to add new features, such as the option to edit your own comments that you already posted and to delete your own comments regardless of what user right you have, and an option to get a permalink to each comment, like in the flow extension(Example: https://i.gyazo.com/8ede610dd4b536499ba58a55e0f38428.png)? Also, is it possible to make the comment editor more extensive with a visual editor and a source editor, again like in the flow extension(Example: VisualEditor: https://i.gyazo.com/7e3ffcc1536cef820acd9a4c782cf03e.png, SourceEditor: https://i.gyazo.com/340408f0cae6e66edd7db3ae383589d2.png)? And would it be possible to add a custom class or an id to the comments of each user so the comments extension would be more customizable in the wiki's CSS and JavaScript stylesheet? Also, some special page maybe to include the comments automatically on the bottom of the articles instead of coping <comments /> tag to every page? --Tribly (talk) 14:43, 23 July 2016 (UTC)

Saving... PHP Fatal error: Call to a member function getArticleID() on null in .../extensions/Comments/CommentsHooks.php on line 81[edit]

Mediawiki 1.26. Trying to add a page via the maintenance page edit.php.

php /var/www/html/wikitales/maintenance/edit.php "New Page with Comments" < "Page contents"

Has anyone else seen this? Is there a fix?

Thanks Donxello (talk) 14:17, 10 October 2016 (UTC)

replace line 81 in the CommentsHook.php with $commentsPage = new CommentsPage( $title->getArticleID(), $wgOut->getContext() );
Hello, can someone put it in the main code base ? I had this issue that prevented me to add categories to my pages ! Tuxxic (talk) 11:56, 29 March 2017 (UTC)
Hi Tuxxic, you'll want to update the Comments extension to the latest commit on the master branch. :-) This line is already on line 81 of the CommentsHook.php file: https://github.com/wikimedia/mediawiki-extensions-Comments/blob/master/CommentsHooks.php#L81 SamanthaNguyen (talk) 12:27, 29 March 2017 (UTC)

MediaWiki 1.23[edit]

G'day, I have expanded the master version of the extension into my extensions folder (/var/www/html/wikiname/extensions), added the line to my LocalSettings.php require_once "$IP/extensions/Comments/Comments.php"; // allows use of comment tags in wiki pages then ran update.php, which I can confirm created workshopComments, workshopComments_Vote, and workshopComments_block tables in my MySQL DB. I thought this version supported DB prefixes. When I log into the wiki and use <comments />, however, it is not recognized as a tag. No errors, just no comments either. Any ideas?

Can a user delete one of his comments without the "commentadmin" right ? + notifications on user comments[edit]

Hi,

I have two needs that I couldn't figure out how to set on my MediaWiki : - I want my simple "users" to be able to delete their own comments only, without being able to delete any other. - I want to get a notification every time a user comments a page.

Is it possible ? Thanks in advance!

It all looks so simple but at the end its not[edit]

A70th year old novice i am As for a lot of extensions it looks so simple to install but at the end it isnt. The same with this one. After placing the files in the extension folder and addinhg wfLoadExtension( 'Comments' ); to my localsettings file one would exspect that the Add Topic tab would apear but NO. What did i miss??

ThenThen under Usage it says :<comments /> — basic comment form, sufficient for most things But where to place this tag it doesnt say.

Fatal error in CommentClass.php on line 242 when running rebuildall.php[edit]

Hi,

I'm getting the following error when running rebuildall.php:

Fatal error: Call to a member function getArticleID() on null in .../extensions/Comments/CommentClass.php on line 242

Using Mediawiki 1.27.3 (LTS)
Comments master branch 4.2.1 (0f417d0), 6 May 2017

I also get the same error using REL1_28 (albeit on a different line number).

Any help would be greatly appreciated.

Thanks,

--BradLeeBH (talk)

Fix for Fatal error in CommentClass.php[edit]

Fixed it by changing line 242 to the following instead:

if ( !is_object($this->getTitle()) || ( $this->getTitle()->getArticleID() > 0 ) ) {

Hope that helps someone else.

--BradLeeBH (talk) 00:41, 25 May 2017 (UTC)

BUG: Allows down-voting despite specifying not to use it.[edit]

When using <comments voting="Plus" /> — it is supposed to prevent users from rating comments negatively (thumb down), allowing only positive (thumb up) votes

Currently it only stops the thumb down icon from showing UNTIL you vote for someone. But after you have voted for someone however, it appears.

This then not only allows you to un-vote someone, but it ALSO allows you to down-vote someone, which is what the "Plus" syntax is supposed to prevent.

Shouldn't the desired behavior be a single up arrow (thumb up) that only allows voting/un-voting, and NOT down-voting as well?

MediaWiki 1.27.3
Comments master branch 4.2.1 (0f417d0)

Kind regards, --BradLeeBH (talk)

Change display of dates to actual date[edit]

Where can I change the date display to show the actual date of the comment? I don't want "X days ago" or "X months ago".

Cmments as a default addition[edit]

Is there anything like making comments as a default option in page templates?

List of comments[edit]

Is there a way to get a public list of recent comments? I would like to list up "recent comments" on the homepage with a link back to the page it was on. An RSS feed could work as well.

Allowing commenting automatically[edit]

Is there anyway to allow commenting on every article automatically without a tag?