Summary: Talk page for CommentBox.
Maintainer: jr
Users: (View? / Edit)

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


PKHG 5 jun - 2014 not working with PHP 5.5 regex with /e modifier

(older comments that have been covered in subsequent bug fixes have been removed) jr

  • I would like a version of comment box that can be coded to a Site.SiteFooter page, but the comments will be viewed on the bottom of any page in the group using $FullName markup, unless there is a nocommentbox markup on the page.
  • 24-Feb-2005I found a small bug (using the commentbox.php): When the Wikitext contains "" (newline) it is changes to a single "" as soon a comment is entered. It look like something happens when the comment is stored. Klonk
    • 27-Feb-2005 I can't replicate this; however, I have removed the wrap='virtual', which may make a difference...
      • Sorry, does not make a difference. I'll check and see whether some other script interferes. Klonk - changed wiki markup a little bit (which helped) as I didn't find a solution.
  • How do I change the css so the comments are in smaller font?
    • make .message, .journal, .diary { font-size: smaller; }
      • This does not really address the issue, where are the <h1> and <strong> tags coming from? There's no reference to the actual HTML - and you can't force h1 to be small via CSS, I've tried and tried and tried. Please, could someone do a cleanup of this code? it's not commented well at all.
  • Is it possible to limit the number of entries displayed per page?
Here's what we might do... First, use a date markup yyyy-mm-dd that gets rendered as a long date. Then set an "omit postings older than $Today - $ExpiredCommentsAfterDays" options. For example (:commentbox 30:) would omit postings more than 30 days old. Finally, we'd need to add "show all" "hide all" "hide expired" links. Is this the kind of thing we want?
  • This is one of the worst recipes I ever used. It messes up with my pages having newlines, and it's not secure when used on a closed wiki. When you type "?action=comment", you can edit a page without having to type a password, and if you password protect the comment thing, you can't let your visitors leave comments, this is a pretty lousy recipe if it is used for a closed wiki.
Thanks for pointing out the security risk. I thought it was enough to hide the comment box, but you are right, it leaves the site open. I will see if this is fixable, meanwhile disable it on my site . What a shame. - HansB
I fixed commentboxstyled.phpΔ with additional security features to make it impossible to edit other pages on an edit protected site. - HansB January 08, 2006, at 09:39 AM
I think the following change fixes the problem. Add this line at the start of the HandleCommentPost function:
                  if (!@$_POST['post']) Redirect($pagename);
Is anything else required? This change is included in commentbox.phpΔ -- jr January 30, 2006, at 11:14 PM
thanks John! So much simpler than what I did! I used your solution now also in commentboxstyled.phpΔ. - On another note: I would love to tidy up this page, as lots of it is not relevant any longer, but I don't wan tto step on anyone's toes. ~HansB

Great recipe!
I'm having a small problem though. I put the (:commentbox:) directive at the bottom of a page below text for the visitor to comment on what he or she reads. However, when a comment is posted, some of my formatting changes, namely the \\ line break and \\\ paragraph lose all but one \.
Any reason this would occur?

thank you, GammaRay

Update: I found a workaround by using the [[<<]] instead. Nothing changes when a comment is posted now.


This was a bug caused by the subsequent pmwiki edit handler calling stripmagic and removing single backslashes. Fixed in version 2.0.13. jr
  • [31-Mar-2006] CommentBox is incompatible with the sectionedit recipe:
    Warning: array_merge() [function.array-merge]: Argument #2 is not an array
       in /www/pmwiki/cookbook/sectionedit.php on line 264
    Warning: array_unique() [function.array-unique]: The argument should be an array
       in /www/pmwiki/cookbook/sectionedit.php on line 266
    Warning: in_array() []: Wrong datatype for second argument
       in /www/pmwiki/cookbook/sectionedit.php on line 287
    Warning: in_array() []: Wrong datatype for second argument
       in /www/pmwiki/cookbook/sectionedit.php on line 287
    Warning: Cannot modify header information - headers already sent by (output started
       at /www/pmwiki/cookbook/sectionedit.php:264) in /www/pmwiki/pmwiki.php on line 857
    i don't know on which side the problem is...

This is Ridiculous.

Would it be possible to make the layout a little more difficult to modify? Otherwise, thanks for a solid recipe. UPDATE. You know what, I take it back. This recipe is totally unstable if modified in any way, even for layout changes. How about this: When I included it in a groupfooter it posts the comment above the rest of the page content, and this obvious bug is still in this recipe despite the authors recommendation that the commentbox markup be PUT in the groupfooter. This recipe sucks, and there is no alternative unless one wants to go into comment-pages or mySQL stuff. Which I don't. This problem is not local to this recipe. The sort of instability, dirty versioning and general mishmashing of code exemplified by this crappy code extension is just the sort of problem absolutely plagues PMWiki in it's entirety. the PMWiki philosophy is "leave the extensions out of the core code and let people install what they need to." this is a great philosophy and I am behind it. But the PMWiki strategy is then to take a Wikipedia approach to code: let everyone modify whatever they want, whenever they want, and release it as gospel to the general user public. THIS WORKS (sortof) FOR INFORMATION BUT NOT FOR CODE. I am sick of things half working. PMWiki could be an excellent piece of software, but PM has to exert a lot more authority. There are basic things people want, and they all have to work, and they have to work well together. A blog, a forum, a commentbox, etc. These are CORE EXTENSIONS. These need to be crisp, well-maintained and versioned, and singular - I am saying ONE endorsed extension for all the major components that people want in a website. There is a place for the arena-style development that is currently throttling the Cookbook. It is excellent to have lots of developers putting new stuff out there and improving (sometimes de-proving) on each other's work. But let me say it again my point is that there are about eight blog recipes and none of them are polished. This is basic functionality and PMWiki has still not got it figured out. Until PMWiki has this, it is going to remain a stew of code that is best used as a jumping off point for PHP developers to create their own wiki, because anything a basic user tries to do will be forever bugged. Personally? I'm going off to search for a program that has some idea of what it wants to be.

 - Disenchanted user Obi
The recipe works as advertised. It suggests placing (:commentboxchrono:) in a group footer -- comments will be added to the bottom of the page. It suggests placing (:commentbox:) in a group header -- comments will be added to the top of the page. Perhaps it should explicitly advise against using (:commentboxchrono:) in a group header and (:commentbox:) in a group footer.

Not completely ridiculous.

I totally support the idea that core functions like blogs, comments, etc should have an official implementation, and also think that such basics should arrive in the default installation. OTOH, I think PmWiki is about empowering people to write their own quirky variations that wouldn't come in either an official or a free-for-all recipe. This is why I like it - it teaches me PHP. That's why it's called a cookbook and not a restaurant. However, if that is the intention, how come I can't find any docs about the overall architecture?

 - Adrian.
I'm not an expert, but my impression is that architecture questions are discussed on the PmWiki user mailing list (which appears to be a PmWiki developer mailing list, actually). You could try to have a look at MailingLists, searching the archive or directly asking the experts. Maybe that's some help to you ... --Henning October 20, 2008, at 03:46 AM
  • Formatting Issue****

How do I control the font size used? Right now the size is too large. The instructions are not clear about this. Thank you. ~Art

Save comment to a private (password protected) page?

I like the PostToAnyPage feature very much. I am in a situation where I would like to collect user inputs, but I do not want to display all the comments due to privacy issues (the page would be reachable by a search box even if I give it a weird name). I tried to password-protect the comment page, but then the commentbox does not work because it requires a password for users to post comment. Can I let commentbox.php get around the authorization and write to the comment page?


Talk page for the CommentBox recipe (users?).