Summary: Talk page for Comments.
Maintainer: Ilya Zverev
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments & Bugs

  • $EnablePostAuthorRequired does not appear to be tested;
  • when using the browser Back Button (following comment Submit), this may cause Post Data to insert a copy of the comment.
  • problem with function commentsFileName. As the source is when i downloaded it, it was recording all my comments in a file "Object.Comments". It is probably not a bug as there is another return statement commented. But when i tried to tweak, i found $WikiDir returning "Object" probably not much here, could be fixed easily.
  • No password is required to post. This is normally what would be expected with a Comments feature, but there is no way to prevent automated comment-spam.
  • On some installations, at least, ever robot's visit to a "comment" link is treated as an added comment - a "Groupname.Pagename.Comments" file is either created or incremented.
  • Comments do not appear on (All)RecentChanges; the (All)RecentComments pages are reverse-sorted.
  • Comments do not appear on activity mailposts (which script is deprecated anyhow). David Spitzley's version - the "commentsmailed" recipe - will send notification if your site has the mailposts script working, but then all robot "touches" are sent as activity - which makes the notifications useless if the robots are very busy generating false positives.

okay i tried to figure it out but i couldn't (looong time i've been doin' php). So my workaround is to replace the return statement with : return "wiki.d/".$pagename.".Comments";

i also tried :

 return $WikiDir->dirfmt.'/'.$pagename.".Comments";

but it doesn't work.

I faced this problem too. here is the fix. change function as follows

function CommentsFileName($pagename) { global $WikiDir; // return $WikiDir.'/'.$pagename.".Comments"; $pagefile = FmtPageName($WikiDir->dirfmt,$pagename); error_log("trying to save to ".$pagefile."comments"); return $pagefile.".Comments"; }

I too couldn't get the comments working right out of the box (at least not with PmWiki 2.0 beta19). The above hack does the trick, but so does this one that Jeffrey Barke gave me. Which one is better? (Replace this in comments.php on line 207)

function CommentsFileName($pagename) { global $WorkDir; return $WorkDir.'/'.$pagename.".Comments"; }

It seems to me that this depends on pmwiki version as pm has changed $WorkDir definition. In pmwiki 2.0beta37 comments are not saved at all. You should change comments.php as follows to fix this

function CommentsFileName($pagename) { global $WorkDir; return $WorkDir->pagefile($pagename).".Comments"; }

  • Is there a way to have recent comments listed at the top of the AllRecentComments page, rather than the bottom? It would be more consistent with the RecentChanges format. Also, I'd like to use the recent-comments page as a WikiTrail and subscribe to it as an RSS feed, but the feed produced by ?action=rss has no items. Any idea how to fix it? GrahamL
  • bug in the AllRecentComments and RecentComments pages generation. The syntax for wikilinks shoud be updated to and not text?.
  • A working example can be found at the Milwaukee Data Consortium's website.
  • I can't see any comments on this site, could you be a bit more specific on where the example can be found. DonT. Try here:

Is there a way to show the comments by default, not only with action=comments?

  • I don't seem to be able to use any Wiki markup in the comments. Any ideas?
  • Comments don't seem to be picked up by the search either.
  • These comments appear to be global to the site, not specific to a page, or have I done something wrong?
    • AllRecentComments lists the pages on which comments have most recently been added, for the whole site, it's analagous to AllRecentChanges; Group/RecentComments lists all comments by wikigroup. Create a link or use ?action=comments#comments in your browser's address bar to view the comments (if any) on a particular page. Does that address your issue at all?
  • I'm also having this problem. I'm using <a href='$PageUrl?action=comments#comments'> as a link within each page, but its showing me the same comments on each page. I'm using PmWiki 2.1.5.
  • The comments engine doesn't work when $EnablePathInfo is set to 1, i.e. if pmwiki uses index.php/Main/Page instead of index.php?n=/Main/Page. With this setting, all comments are added to the Site/PageNotFound page.
  • Does it work with the newest 2.1 Beta Releases?
    • It works, but $PageName in the Forms definition must be replaced by small characters 2 times ($pagename) uudo
  • Q1: Is it possible to always show the commentbox (instead of using action=commentbox)?
  • Q2: I use commentsmailed, it seems that I always get a mail when somebody clicks on the commentbox link for the first time each page, even if no comment is entered. How can I get only a mail when something is entered?
    • My PmWiki | commentsmailed.php - uudo May 29, 2006, at 05:41 AM
  • Perhaps it's just the sample provided, but it looks like comments containing raw XHTML, including the <script> tag are allowed. I've created an annoying JavaScript alert as an example...
  • The function CommentsFileName($pagename) misuses the $WikiDir global. This change makes comments for a particular page appear only on that page

function CommentsFileName($pagename) { global $WikiDir; return $WikiDir->pagefile($pagename.".Comments"); // return $WikiDir.'/'.$pagename.".Comments"; // return $WikiDir.".Comments"; }

  • Q: commentsmailed.php uses the deprecated MailPost module. How hard would it be to convert it to use the Notify Module?
  • line 181: I think it's better to use <br /> rather than \n

$comment = explode("|",str_replace($Newline, "\n", rtrim(fgets($comfile, 4096))));

Talk page for the Comments recipe (users?).