Summary: Talk page for CommentBoxPlus

Post your questions and comments here, the latest at the top

I upgraded pmwiki from 2.2.120 to pmwiki 2.3.25 to use it with php8. All is fine except for the commentboxplus recipe (command '(:commandbox:)'). When I publish a comment, nothing appears. I still see the old comments, nut the new one doesn't appear. I have no log in the error.log apache log, nor in the F12 Firefox web console. Vincent Ducastin 2023-09-25 at 16h24 UTC

HansB: updated recipe for PHP 8.1 compatibility. - 26 Sept. 2023

Vincent Ducastin: Now it works, thank you !! - 26 Sept. 2023

I want the author part to disappear. I've activated it: rotozymo? February 25, 2020, at 06:35 PM

You can do this in your config.php:

# Override these two Fmt strings 
$MPTimeFmt = "(:nl:)>>messagehead<<(:nl:)!!!!![-at \$Time-]  $weblink \n";
$MPDateTimeFmt = "(:nl:)>>messagehead<<\n!!!!![-\$Date, \$Time-]  $weblink \n";

AntonyTemplier February 26, 2020, at 01:12 AM

no it doesn't work. There should be no author name other than the login name. rotozymo? February 26, 2020, at 03:59 AM
appears in page history. users can type each other's name. rotozymo? February 26, 2020, at 04:18 AM
You need to force authentication to trust comment's authorship. To do that add in your config.php:
        # AuthUser
        $Author = $AuthId; # To have only login name

        # CommentBoxPlus
        $MPAnchorFmt = "(:commentbox:)";
        $MPAnchorChronoFmt = "(:commentboxchrono:)"; 

And in your pmwiki page add :
(:if auth edit:)(:commentbox:)(:if:) or
(:if auth edit:)(:commentboxchrono:)(:if:)
AntonyTemplier February 26, 2020, at 10:18 AM
no way to completely remove the box? Let the name of the author appear if logged in. If it is not logged in, it will appear anonymous. I'm sorry for my bad english. I guess it was not well understood. rotozymo? February 26, 2020, at 02:30 PM
You can do that by changing the form. AntonyTemplier February 26, 2020, at 06:45 PM
In config.php :
# AuthUser
$Author = $AuthId; # To have only login name

# CommentBoxPlus
// Changing the form to comment
$CommentBoxFmt ="
    <div id='message'><form name='cbox' class='inputform' action='".PageVar($pagename, '$PageUrl')."' method='post' onsubmit='return checkform(this);'>
    <input type='hidden' name='n' value='\$FullName' />
    <input type='hidden' name='action' value='comment' />
    <input type='hidden' name='order' value='\$Chrono' />
    <input type='hidden' name='postto' value='\$PostTo' />
    <input type='hidden' name='accesscode' value='\$AccessCode' />
    <input type='hidden' name='csum' value='$[Comment added]' />
    <input type='hidden' name='author' value='\$Author' />
    <table width='90%'><tr>
    <th class='prompt' align='right' valign='top'>$[Add Comment]&nbsp;</th>
    <td><textarea class='inputtext commenttext' name='text' id='text' rows=6 cols=40></textarea>
    ($EnableWebsiteField ? "</td></tr><tr><th class='prompt' align='right' valign='top'>$[Website]&nbsp;</th>
    <td><input class='inputbox' type='text' name='website' value='' size='32' />" : ""). 
    (isset($EnablePostCaptchaRequired) ? "</td></tr><tr><th class='prompt' align='right' valign='top'><input type='hidden' name='captchakey' value='\$CaptchaKey' />
    Enter code: <em class='access'>\$Captcha</em></th><td><input type='text' name='\$CaptchaName' size='5' class='inputbox' /> " : "").
    ($EnableAccessCode ? "</td></tr>
    <tr><th class='prompt' align='right' valign='top'>$[Enter code] <em class='access'>\$AccessCode</em></th>
    <td><input type='text' size='4' maxlength='3' name='access' value='' class='inputbox' /> "
    : "<input type='hidden' name='access' value='\$AccessCode' />").
    "<input class='inputbutton commentbutton' type='submit' name='post' value=' $[Post] ' />
    <input class='inputbutton commentbutton' type='reset' value='$[Reset]' /></td></tr></table><br /></form></div>".
    ($EnableCommentFormCheck ? $CommentBoxCheckFmt : '');

great, working, thanks a lot rotozymo? February 26, 2020, at 07:09 PM

isset($EnablePostCaptchaRequired) should be changed to $EnablePostCaptchaRequired==1 for auth'd users to work as supposed -- BlacK? June 03, 2018, at 05:38 PM

There was a bug having to do with links in comments. The fix is too long to summarize here, so I've uploaded a fixed version:


Said Achmiz November 03, 2017, at 09:26 PM

  • how one should notice this CBMessage()?
  • how to make such text to not disappear after page refresh? -- BlacK? June 03, 2018, at 05:25 PM

After I upgraded PmWiki (to pmwiki-2.2.104) and CommentBoxPlus (to Version: 2017-06-21) on my server running PHP5.6, I had an issue that all the comment posts would appear at the top of a page, latest first, with (:commentboxchrono:) put in a GroupFooter. They should appear at the bottom chronologically. I'm not familiar with PHP scripting but somehow I managed to fix this by replacing lines 380-381:

$before = '';
$after  = $pagetext;

with the following.

$before = $pagetext;
$after  = '';

Jun Fukumitsu,, Oct 15, 2017

This fix isn't quite right, as it puts the comments below the comment box when using (:commentboxchrono:), which is contrary to the docs. The actual fix seems to be to comment out line 192:

 global $Chrono, $PostTo, $AccessCode, $CaptchaValue;

That makes everything work right, as far as I can tell.

Said Achmiz November 03, 2017, at 06:18 PM

Add (:commentbox:) markup to header or footer of group or site to get comment box to display on each page uniquely, as in $FullName
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. Each page would have a unique comment box with only one code on a Group or Site footer.

Feature idea
I thinàk it would a nice feature to allow the wiki administrator, or comment moderator, to be able to differentiate his or her name from the other names in the comments. This could be done by recognizing a $CommentAdmin role and allow styling for this person.

Some ideas:

  • Allow an administrator to designate his/her name in config.php with, for instance, $CommentAdmin = "Alice";
  • Disallow visitors from using the name of the administrator to spoof messages (important)
    • I'm not sure how this would work as it might require AuthUser
  • add CSS styling with, for instance, .commentadmin { background-color: #e6e6e6; }

I don't have much php knowledge, but I'm good with CSS and I would be willing to test, submit bug reports, and help in other ways.
Ian MacGregor

If you use CommentBoxPlus and AuthUSer together, you can do this with those few steps :

1- Setup AuthUser

In page SiteAdmin/AuthUser:

Usernames and encrypted passwords:
  alice: $1$kk8YY79C$Znq7PBakXTSuIHX2Etyv90
  bob: $1$xoApFd67$y4uhxaNlRzRlV6Jf1zCZx.
  superman: $1$r9FbsBWI$175DchvK.XLHvYUyIXeSk0

Authorization groups:
   @editors: alice, bob
   @admins: superman

And in your config.php:

$DefaultPasswords['admin'] = '@admins';
$DefaultPasswords['edit'] = '@editors';

Check AuthUser for more details as there is different many ways to setup a pmwiki with AutUser.

2- Add some special CSS classes for particular users

We need to change format strings of comments by overriding some variables provide by this recipe. These var are described in Cookbook.CommentBoxPlus.

In your config.php :


# A moderator: someone that can edit the page (like Bob an Alice)
# We add .messageitemModerator and .messageheadModerator CSS classes to the default formatting string
if (CondAuth( $pagename, 'edit')) {
  $MPItemStartFmt = ">>messageitem messageitemModerator<<\n";
  $MPDateTimeFmt = "(:nl:)>>messagehead messageheadModerator<<\n!!!!!\$Author  &mdash;  [-\$Date, \$Time-] $weblink \n";
  $MPTimeFmt = "(:nl:)>>messagehead messageheadModerator<<\n!!!!!\$Author  &mdash; [-at \$Time-] $weblink \n";


# Admin : the one that can do everything (like Superman)
# We add .messageitemAdmin and .messageheadAdmin CSS classes to the default formatting string
if (CondAuth( $pagename, 'admin')) {
  $MPItemStartFmt = ">>messageitem messageitemAdmin<<\n";
  $MPDateTimeFmt = "(:nl:)>>messagehead messageheadAdmin<<\n!!!!!\$Author  &mdash;  [-\$Date, \$Time-] $weblink \n";
  $MPTimeFmt = "(:nl:)>>messagehead messageheadAdmin<<\n!!!!!\$Author  &mdash; [-at \$Time-] $weblink \n";

3 - Styling

Add theses lines at the end of the pub/commentboxplus/commentboxplus.css file :

/* Override styles for moderator : blue writting for Bob and Alice*/
.messageitemModerator p, .messageheadModerator { color: blue; }

/* Override styles for admin : red writting for Superman */
.messageitemAdmin p, .messageheadAdmin { color: red; }

If 're comfortable with CSS Styling, you can now improve commentboxplus.css to meet your needs.
AntonyTemplier November 01, 2013, at 07:07 AM

I had to edit SiteAdmin/AuthUser first, and then config.php in Step 1, otherwise I wasn't able to log in at all. But, this works perfectly! Thank you very much! Ian MacGregor November 1, 2013
Ok thx, instructions order is now correct. AntonyTemplier November 01, 2013, at 06:52 PM

It appears that visitors are able to enter directives of the form (:...:) into the Author text box. Once the comment is posted, the directives aren't displayed on the page but these directives can be seen when the page is edited using the ?action=edit link. The setting $EnablePreventDirectives = 1; doesn't prevent this for the Author text box.
Tested on October 27, 2013, at 12:17 AM Ian MacGregor

Try the new version 2013-10-31 that should fix it. The same rule as in author.php are now applied to the author's name field for the commentboxplus recipe. AntonyTemplier October 31, 2013, at 06:31 AM

Thank you very much, Anthony! Will be trying this new version out today Ian MacGregor October 31, 2013

I have a small number of users on a private pmwiki install. How would I display an avatar next to the author's name based on an attached file (already uploaded by me) that was named something like "$Author".jpg? I would like the message to display the avatar, author's name and date in the message header. Thanks! _CN 14Nov2012

Is it possible to remove Author field from being saved? I'm not so much into php. Changed a lot of script but I just can't figure out how to disable from author field being stored/saved; when you open page again, block will contain last value you wrote inside it.

tiger; 20.02.2011.

In the script change about 12 lines down after SDV($CommentBoxFmt,"..... value='\$Author' to value='' - HansB February 21, 2011, at 04:57 AM

Hi thx for the very helpfull recipe. I use it quite a lot, but I run into a problem (or a feature?) i can't handle.

If I put some "[(approve links) edit diff]" into the commentbox and send it, all my text is flushed to nowwhere. No message, no comment on the page, nothing at all. So I cannot put links from out the box. What is the deeper meaning? Is that some crosseffect? I put into my

 $EnablePostToAnyPage = true;
 $EnablePreventDirectives = false;
 $MPAnchorFmt = "[[#comments]]";
 $MPAnchorChronoFmt = "[[#comments]]";

At least, now the PostToAnyPage works, but I jump after Posting to the Commentpage. Any hints?

xian? April 25, 2010, at 09:51 AM

Hi xian?. I had the same problem the first time I used this recipe. I found that commentboxplus.php (version: 2007-12-21) have a problem into the function HandleCommentPost when calls function auditJP.
Replace this line:

if(auditJP('', $req)==false) Redirect($pagename);

... for this line:

if(auditJP($MaxLinkCount, $req)==false) Redirect($pagename);

One more thing: remeber add to global list of HandleCommentPost the $MaxLinkCount variable.

global $MaxLinkCount;

Now you can assign a value to $MaxLinkCount variable from config.php file.
I hope this will be useful for someone {smiling}
eseval June 22, 2011, at 12:20 PM

Pushing comments to other pages does not work (as noted by someone below). A possible culprit is malformed if. The correct version that works for me:

if($EnablePostToAnyPage==1) {
  $pagename = $tgtpage;
} else {
  if($EnablePostToGroupPage==1 AND $tgtgroup==$currgroup )
    $pagename = $tgtpage; 
  else {
    foreach($PostToCommentPageFmt as $n ) {
      $n = FmtPageName($n, $pagename);
      if($n==$tgtpage) { 
        $tgt = 1;
        $pagename = $tgtpage;
    if(!isset($tgt)) { 
      CBMessage("ERROR: No permission to post to $tgtpage");


It works a charm love it.

I would like to change some of the css features of the commentboxplus ...

  • I would like to remove the author profile link ... Just want the authors' name
  • change the heading level or colour


Mark Feb 1st 2010

Another question: What is wrong between CommentBoxPlus and Pm's Captcha recipe? I installed Pm's Captcha recipe and set the $EnablePostCaptchaRequired = 1; to activate it. Now, if the first author completed his comment by typing authorname, captcha number and hit the post button then now saving of the comment was made. But if the first author clicks a second time to activate the comment pageside ahead his writing it works correct. Where is the bug?

Helmut January 17. 2010 18:28

Hi, i just implement the commentboxplus in a website. It works well. Now i ask you, is there a way to limit number of rows or the quantity of bytes in the each comment? And show the writer the limt at least?

Thanks! Helmut January 12, 2010 17:25

Hi, well i like the commentboxplus too, but it at my place it doesn't work to push comments to other pages. I setup the groupfooter to show given comments from the discussionpage and to add new comments

(:if exists Talk.{*$Group}-{*$Name}:)
Already writte Comments:
(:include Talk.{*$Group}-{*$Name}:)

Add a new Comment at [[Talk.{*$Group}-{*$Name}]]
(:commentboxchrono Talk.{*$Group}-{*$Name}:)

The config.php goes like this

$EnablePostToAnyPage =1;
$AllowPostToGroups[]= 'Talk'; 

But - and maybe this is it ? - I save my files in GroupFolders following the code:

$WikiDir = new PageStore('wiki.d/$Group/$FullName');

It is not, doesnt work in virgin pmwiki-installation tooxian?

Once again. The comment is written at the end of my article-page. Not in the groupfooter, but also not into the requested Talk-Page. Any help?

xian? November 15, 2009, at 03:10 PM

Hi, This is an awesome recipe! Is it possible to include a file (photo) upload field?

Thanks! Amy

I have no plans to extend commentboxplus any further. You could build a custom form using Input and a form processing script like PmForm or Fox. HansB September 25, 2009, at 03:19 AM

Hi just wanted to say I love this recipe and use it on [(approve links) edit diff] I used a different one and always got attacked by spam bots. I tried using the captcha cookbook unforunately I can't get it to work but the built in three digit number seems to holding up.

Anyway thanks for such a wonderful cookbook!

- Mark

For a much cleaner looking comment box I added the following code to my config.php (after including commentboxplus.php). It does not use tables and it places the labels on the right hand side:

$CommentBoxFmt = "
<div id='message'>
   <form name='cbox' class='inputform' action='\$PageUrl' method='post' onsubmit='return checkform(this);'>
      <input type='hidden' name='n' value='\$FullName' />
      <input type='hidden' name='action' value='comment' />
      <input type='hidden' name='order' value='\$Chrono' />
". ($EnablePostToAnyPage ? "
      <input type='hidden' name='postto' value='\$PostTo' />
" : "" ). "
      <input type='hidden' name='accesscode' value='\$AccessCode' />
      <input type='hidden' name='csum' value='$[Comment added]' />

      <p class='vspace'>
	 <input class='inputbox commentauthorbox' type='text' name='author' value='\$Author' size='32' />
	 <label for='author'>$[Name (required)]</label>
". ($EnableWebsiteField ? "
      <p class='vspace'>
	 <input class='inputbox' type='text' name='website' value='' size='32' />
	 <label for='website'>$[Website]</label>
" : ""
).($EnablePostCaptchaRequired ? "
      <input type='hidden' name='captchakey' value='\$CaptchaKey' />
      <p class='vspace'>
	 <input type='text' name='\$CaptchaName' size='32' class='inputbox' /> 
	 <label for='\$CaptchaName'>$[Enter Code:] <em class='access'>\$Captcha </em> $[(required)] </label>
" : "" ). ($EnableAccessCode ? "
      <p class='vspace'>
	 <input type='text' size='32' maxlength='3' name='access' value='' class='inputbox' />
	 <label for='access'>$[Enter Code:] <em class='access'>\$AccessCode </em> $[(required)]</label>
" : "
      <input type='hidden' name='access' value='\$AccessCode' />
"). "
      <p class='vspace'>
	 <textarea class='inputtext commenttext' name='text' id='text' rows=6 cols=40></textarea>

      <p class='vspace'>
	 <input class='inputbutton commentbutton' type='submit' name='post' value=' $[Post Comment] ' />
". ($EnableCommentFormCheck ? $CommentBoxCheckFmt : "");

Trent? June 05, 2009, at 06:44 PM

Is there a way to add two or more comment boxes on the same page? I tried to add two (:commentbox:) on different locations on the same page, the boxes appear but all the entries are placed on the first / top one.

Great work! Exactly what I was looking for, as the previous version wasnt working for me. One question: Is there a way to display somewhere in the same or in another page the number of comments made? I.E., I want to inform readers of how popular an article is (as in how many comments it has so far) before they enter it, by display the number of posts next to the link that opens that particular article. Sportsman?

The page variable {$PostCount} will give you the number of messages posted. HansB April 08, 2008, at 05:54 PM

Is adding the markup in the page all i have to do to get the post number, because i did it and all i got was nothing displayed after i saved. Not even the text appeared. Should I be doing something else as well? Sportsman?

{$PostCount} displayes the number of >>messagehead<< sections in the page. So putting it into the page which holds your messages it should show the number of messages, as each message is formatted with a >>messagehead<< section at the top. HansB April 10, 2008, at 03:59 AM

Very nice receipe! I have only a little suggestion. I added PM's Captcha and set the
to activate it. But then I have to use the captcha everytime I edit a page. In my case this is not useful, because my pages are already write protected. So I set up new variable
and replaced $EnablePostCaptchaRequired by $EnablePostCaptchaRequiredCommentBox in the commentboxplus.php. Then I have the captcha in the CommentBox but nowhere else. Maybe this would also be helpful for others.

FH February 14, 2008, at 06:34 AM

instead of changing commentboxplus.php you could use this in config.php:

$EnablePostCaptchaRequired = 1;
if (CondAuth($pagename,'edit'))
	$EnablePostCaptchaRequired = 0;

HansB February 14, 2008, at 01:37 PM

Ok, that sounds much better! Thanks
FH February 14, 2008, at 02:12 PM

When I post comments to another page with (:commentbox Engineering.TestBlog-Comments:), they do not show up in my RSS feed or in RecentChanges. (Version 2007-12-09a)

On loading a page with (:commentbox:) inside I get a javascript syntex error (at bold line, Firefox is pointing on red &&):

  function checkform ( form ) {
   if (form.text && form.text.value == "") { window.alert( 'Please enter a comment to post' ); form.text.focus(); return false; }
   if ( && == "") { window.alert( 'Please enter your name as author' );; return false; }
   if (form.access && form.access.value == "") { window.alert( 'Please enter the code number' ); form.access.focus(); return false; }
   if (form. && form..value == "") { window.alert( 'Please enter the code number' ); form..focus(); return false; }
  return true ;

After sending a comment I get "checkform is not defined at line 1"
I am using the latest SVN version of PmWiki and CommentBoxPlus2, $EnableAccessCode is not used / enabled in config.

Fixed now. I added a conditional check if accesscode or captcha is enabled. Thanks for the alert! HansB November 10, 2007, at 03:22 PM

Maybe something is wrong with this update (Nov 10)? The CSS file is not loading because of an incorrect path:

  <link href='/commentboxplus/commentboxplus.css' rel='stylesheet' type='text/css' />

It should be

  <link href='/pub/commentboxplus/commentboxplus.css' rel='stylesheet' type='text/css' />

or not?
I don't have a farm, only a standard installation.

The css loading is fixed now. The bug was introduced yesterday, sorry! HansB November 11, 2007, at 02:48 AM

$EnablePreventDirectives doesn't quite work: a user can still put directives in the Author field. It's easy to fix - just copy the line that prevents them and change "text" to "author".

This has been added now. Plus Captcha support! HansB November 09, 2007, at 12:03 PM

Hans, this seems to be broken again, I installed this recipe yesterday. Submitting wiki markup in the Author field works and it shouldn't be allowed. Ian MacGregor

Very nice plugin, it works almost flawlessly. However when there are \\'s in the page (outside the commentbox itself), these seem to get lost upon posting a comment. Changing the 'stripmagic' in commentboxplus2.php to 'PSS' seems to fix this, but i'm not sure why the stripmagic is needed, so PSS might not be the right thing either. Anyone knows?

Fixed now (I hope, since this has come up from time to time). HansB November 09, 2007, at 12:04 PM

Complete noob. How do I get the entered comments to be in a colored box or something? Right now they look like regular page content. Thanks for the "recipe" and any assistance.

Welcome aboard! Did you notice that the installation instructions have two parts - did you do the part that says "commentboxplus.css to $Farm/pub/commentboxplus/ folder"? That's where the formatting of the comments comes in (I think).
Thanks. Looks like I did miss that part in my excitement. LOL. I'm really thrilled with pmwiki so far. I think several friends are wanting to use it now...

Update: Well, I did have the css file in pub/commentboxplus folder, according to the instructions on the cookbook page. But the php file says put them in the pub/css folder, so I tried that. Now it works.

Now, how can I put "Comments:" at the top of where the comments will display? When I put it in the GroupFooter, it shows above the input form, not the comments themselves. Thanks in advance. Rena? July 26, 2007, at 06:14 PM

You need to put it in the page where the comments go, above them, or above the comment placement marker, if you use one. HansB November 09, 2007, at 12:10 PM

Excellent product! One question. When I add (:commentbox:) to the page, the input boxes appear at the bottom of the screen. How can move the input box to the top of the screen? Tnx! DJ (19-07-2007)

Read about setting $MPAnchorFmt and $MPAnchorChronoFmt (the latter for use with commentboxchrono markup (chronological comment display). HansB July 21, 2007, at 04:13 AM
DJ: $MPAnchorFmt is to define the location of the comments that you enter, correct? No matter what I do the input boxes (authorname, message) appear at the bottom of the screen. (skin related? SimpleTab). And it's these field that I would love to have at the top of my screen, with the comments below.. 26 jul 2007

Hello Hans,

is it possible to deactivate all links user include in their comment? For me it would be enough, if www. or http:// is cut away. The rest can stay. So the reader can decide to reconstruct the link and to follow. I dont want, that there is a link, anybody can follow at once by a simple click. And I dont want to through out this function lazyweb, which activates www. to a working link in normal text. I like and use the commentboxes very much!
Many greetings
Hans ( or )

In my older version of commentboxstyled I add some lines in the function HandleCommentPost. Now all links are deactivated, but still readable:

function HandleCommentPost($pagename) {
  global $_GET,$_POST,$JournalPattern,$DiaryPattern,$Author;
  global $AuthFunction, $oAuthFunction;
  if (!@$_POST['post'] || @$_POST['text']=='') Redirect($pagename);



function LinkDeaktivation(){
global $_POST;
$neu =$_POST['text'];
$post_lower =strtolower($neu);;
$linkskennung = array("www.","http://","<a ","href=","</a>");
$Ersatz ="-";

for ($mi = 0; $mi < 5; $mi++) {
$Suchmuster = $linkskennung[$mi];
   while (strpos($post_lower, $Suchmuster) >0) {
   $neu = eregi_replace (  $Suchmuster,  $Ersatz,  $neu );
   $post_lower = ereg_replace (  $Suchmuster,  $Ersatz,  $post_lower );
} # Ende for
$_POST['text']= $neu ;

Hi Hans, I love this recipe! Great work! I just have one issue I'm trying to figure out...

I have my commentbox form set up in a group footer, and it is nested inside a toggled div section like the one on the Toggle Test page, here. I am wondering, is possible to have the commentbox form AND the comments completely contained within the toggle div section? Right now, when I post comments to my page using the toggled commentbox form, all the posts appear outside the div, at the top of the page. I have tried changing the $MPAnchorFmt variable, but to be honest I don't think I'm doing it right. Could you point out where in the php file to make the change? Do you think this containment is possible with this recipe?

You can see what I'm working with [(approve links) edit diff]. The commentbox is located at "show comments". Thanks! :: wK

Set it up somehow like this:

(:showhide init=hide div=commentdiv lshow='Add Comment' lhide='Close':)
(:div1 id=commentdiv:)



And set in local config:

$MPAnchorFmt = '[[#comments]]';

HansB June 01, 2007, at 10:51 AM

Is it possible to not have the comment box input displayed on a particular group or page?

For example. I do not want it shown on my wiki homepage/portal page, but I want it on every other page within the wiki. ~Garth - 2007-04-16

Worked it out. I used: (:if !equal {$FullName} "Main.HomePage":)(:include Comments/{$Group}-{$Name}:)(:commentbox Comments/{$Group}-{$Name}:)(:if:).
You can see the page Page Variables for a list of what variables you can use. ~Garth

How do I set up CMSLike recipe to work with commentboxplus? It requires that I log in to post comments.

Commentboxplus is designed to allow posting even if you have no edit permission. You could show the comment box only for edit authorised users by using (:if auth edit:)(:commentbox:)(:if:). Otherwise you could use Fox, build a comment form (see example), and set $FoxAuth='edit';. HansB January 11, 2007, at 03:57 AM

Hi, very nice work indeed, thank you. Is it possible to tell the script to show only the last x comments and/or a link to the older ones? Thanks -- Richard Found it already under Adding page breaks, I added Limit Number of Posts to it, so it is easier to find.

Hello Hans, I love this recipe. Thanks for all the hard work =). The anchor is particularly useful, however is there a way we can assign it to a variable? For example, the user can choose which area of the page to post comments to by choosing a section from dropdown box. I have attempted to change the comments to something similar to $MPAnchorChronoFmt = "[[#{*$CommentLocation}]]"; where $CommentLocation is the input from the dropdown; However, I'm not advanced enough to know what I'm doing =). Any Help would be appreciated. Paul F. 12-20-2006

Hi Paul, a very interesting idea, but not so easy to do! $MPAnchorChronoFmt only tells the script what anchor or string to search out in the text, and to cut the text there, and insert the post. So you need have that anchor in the text. A page variable in the definition may work, but you need to integrate a drop-down input control with the script, so the choosen value will be passed on. And you need to have those anchors in the page to choose... It seems a big modification, and I am afraid it is possibly not worth the effort, since commentboxplus is built using its own form definition, and so is not too flexible. - Funnily enough I am musing over the same problem, of choosing amongst various anchors to insert posts, in my development of Fox. And Fox got the flexible framework to achieve this. I hope to achieve post insertion after any post on the page, which will lead to a threaded forum model.... HansB December 20, 2006, at 03:21 PM

Hans, I'd like to give commenters the option to select whether their comments are public or private (whether they can be read by everyone, or simply the administrator) and to categorize their comments (ideally, having them post to different pages).

The idea is for a suggestion box for an organization, where comments can be posted anonymously. While it would be nice for posters to be able to read the suggestions of others, some might not want others to be able to read their suggestions. I want to keep the threshold as low as possible to encourage suggestions, I won't be setting up any login or profile options.

Any suggestions of the best way to accomplish this? I assume that PM's new input select markup would be a great way to provide for posting to different pages, if CommentBoxPlus could be made to work with an input select.

Hi Pico, I have come to realise that commentboxplus is already stretched to its limits, and every change in its form to accommodate this or the other is quite difficult, simply because commentboxplus defines the form in the script, and is not using (:input:) form markup (although it can be used for the basic function). - So right now I am in the finishing stage of a completely modified version of adddeleteline2, which will have a built in option to post to different pages, have links to delete posts (by admin or poster), utilises (:input:) markup, so you can use select or radio buttons to switch your post to a different page etc. I am aiming that it will do all what commentboxplus does, can be used for forums, blogs, contact lists, all kinds of form posting using template pages. But it will not go as far as Zap in creating a new page for each post. Instead you can choose from a number of ways to append or prepend your post to various locations, on the page or a different target page. - You can see already examples on my site (look for ADL), but the final version will still be a little different. It should be ready in a few days. - HansB December 15, 2006, at 03:56 PM

Wow! Very exciting. I can't wait to have a look. Pico

Hans, when entering an e-mail address as 'author', commentbox2 will post the comment, but not the author name. Next to that, the valid e-mail address is converted into a complete string without dots and @ as the author name. Is this by design or did I overlook something please?

It is not designed to recognise email addresses as valid author names. I think PmWiki is not doing this anywhere. It can cope with a normal author names, even with spaces. -HansB

Hi, Thanks for this useful recipe. I'm a novice at wiki but just trying. This recipe works great but it seems to have index problem when used with TOC recipe. A sub-number index is added to the comments. After reading the discussions down there I tried add

$MPDateTimeFmt = "(:nl:)>>messagehead<<\n \$Author &mdash; [-\$Date, \$Time-] \n";

changing !!!!! [[~\$Author]] just to ~Author. But I'm not sure this is the best way. Kitak

see next answer, try take out the header markup fo the comment heading ($MPDateTimeFmt). ~HansB

Hi- I'm using commentboxplus2 and Triad. The heading above each prior comment is very large and I haven't found a way to decrease it. If I use Triad to shrink the typesize, the content is too small in proportion to the header. By the way, I really like the like the way Triad lets the viewer control text size for the benefit of those with vision problems. It also responds to the needs of older users. Thanks, Brendan

you could perhaps redefine the comment header, taking out the header !!!!!, like: $MPDateTimeFmt="(:nl:)>>messagehead<<\n'''\$Author''' &mdash; [-\$Date, \$Time-] $weblink \n",

Hi there, what's the current "best recommended way" to delete comments? Thanks! Jordan

I know only one way: edit the page and remove entries. But this upsets the indexing numbers, unless it is just the last comment(s). New comments after this will start their index number at the number of counted comments. So you might get comments with the same index number. This may not matter too much. The total number of comments stays correct. ~HansB

Hi, I updated files and deleted old configuration files. But - if I insert a text into comment box and press ok button, then NOTHING changes! flox August 19, 2006, at 10:37 AM Is there a url I can look at? HansB flox August 20, 2006, at 11:21 AM

Seems to work for me on your site. Created Diskussion.Test. Posts are at the bottom. ~HansB
thx. Ok...But the Commentbox doesn't work with the blog because of this code in BlogComments.GroupFooter:
(:input textarea text rows=7 cols=50 class=inputtext:)[[<<]]
Author: (:input text author {$Author} class='inputbox':)\
 (:input submit post Post class='inputbutton':)\
 (:input reset reset Reset class='inputbutton':)(:input end:)
No access code is submited.
Thanks for pointing this out! If you need blog comments with access code enabled, you would need to use the standard (:commentboxchrono:) markup, instead of the (:input:) markup in the GroupFooter. Or disable access code for the blog groups. I wonder if we can get the access code working with a user defined (:input:) form. ~HansB
Yes, I changed it! I like access code because of spammers... If you want to add support of user defined (:input:) form, please DON'T use Javascript. My sites should be useable without Javascript ;-) flox August 20, 2006, at 03:31 PM
I added page variable {$AccessCode} to the script, so now one can build comment boxes with (:input:) forms. Just add these:
(:input hidden accesscode {$AccessCode}:)
Enter code %red%'''{$AccessCode}'''%% 
(:input text access size=4 maxlength=3 class=inputbox:)

Hi, Hans: Is SimpleForum affected in any way by the latest changes here? That recipe still calls for the old "CommentBoxStyled", and I'd expect it to work with the new recipe instead, but the download link there still points to the older recipe, so I'm a bit confused. Thanks! -- Tegan
I have not yet updated that page (updated now). It should work with the new version. --HansB

Hi, could you include the feature (anti-spam) from commentbox 2.0.16? thx! flox August 17, 2006, at 04:05 AM Done now. -- HansB August 17, 2006, at 12:50 PM

Hi Hans, I did try the commentbox styled, but it seems that if I post a comment to a specific page the script dont redirect to the current page but opens the target page. It would probably be got if it would be a configurable option, grz nos Profiles July 12, 2006, at 11:58 AM

I´ve put the "(commentbox:)" in the Group.Footer in one of my groups. I looks alright but when I submit a comment it´s placed at the top of the page instead of under the comments form like it is if I put "(commentbox:)" directly at the page. I've tried to put a "[[#comments]]" under the comments form i the footer but it didn´t work. I need help, please. Robin August 10, 2006

You need to use (:commentboxchrono:) in the GroupFooter, which will place comments in the page above, in chronological order, latest post last, bottom. Or use (:commentbox:) in the GroupHeader, which will place comments below in the page, latest above the others. ~HansB

I'm having problems posting comments without edit rights. The commentbox works fine when I am logged in, but when I log out and post a comment, the commentbox directive is posted instead of the comment (literally, the page displays "(commentbox:)" where the comment should be. I have the commentbox directive in my group footer and am using MPAnchorFmt and MPAnchorFmt to place the comments (I'm still deciding whether to use chrono or not). I don't know if this will reproduce easily, so do you have any suggestions of things I should do to troubleshoot this. Pico August 10, 2006, at 08:54 AM

You need to use (:commentboxchrono:) in the GroupFooter (see next answer). (:commentbox:) should not be posted literally, and I have no idea why this happens for you. Have you changed the commentboxplus.php script somehow? Can you use it unchanged? Do you have set $EnablePostAuthorRequired = 1; in config.php? Did the script work before the latest update to include $MPAnchorFmt? ~HansB

I tracked it down some interaction with Hagan's CMSBundles? and, specifically, to the CMS Mode script contained in cmsb-cmsmode.phpΔ: when I comment out that include, the comment box works without editing rights, when I uncomment the include, the comment box is posted literally when I lack edit rights. When I went to leave a comment on CMSBundles? I found that this specific issue has already been identified. Pico August 10, 2006, at 08:30 PM

You need to add the 'comment' action to the array of allowed actions for the cmsmode script. Put in config.php before including the script:
$CMSAllowedActions = array(
-- HansB

Hans, a couple of questions: 1. I want the body of the message to be preformatted by default, using either the newly allowed >>white-space=pre<< style, or the old escape [@ markup. What is the best way to do that?

You can try $MPItemStartFmt = ">>messageitem white-space=pre<<\n"; or try changing the css setting for .messageitem

Changing MPItemStartFmt worked. But I removed the /n because it caused a blank line to be inserted at the start of each message. I also specified the monospaced font using $MPItemStartFmt = ">>messageitem white-space=pre font-family=monospace<<"; (That font still does not match the font that is used by PmWiki's whitespace and escaped rules, but at least it reduces some of the difference between normal and indented text). Pico August 10, 2006, at 01:07 AM
Try font-family=courier or font-family='courier new' instead. ~HansB

2. Is there anyway to control the placement of comments on a page, beyond having them placed at the very top, or very bottom? Ideally, it would be great if there was an option that allowed comments to be placed at an anchored location, e.g.

Body of text
Comments inserted here
Closing text

Thanks. Pico August 08, 2006, at 11:08 AM

Done now in latest update. Set $MPAnchorFmt = "[[#comments]]"; HansB August 09, 2006, at 01:40 AM

Wow, everything I asked for, and fast. Thank you. Pico

It would be very useful to be able to keep a log of all comments added to a website. Say you have a working blog or site using commentboxplus for comments, and you have 100 or more pages, each with a comment box... keeping a comments log would be very helpful for the site owner, so that he/she can see whether any new comments have been posted to the site, or not. h, 8/6/2006.

Posting a comment shows up as an entry in RecentChanges and Site.AllRecentChanges, so you can see there about recently added comments. An RSS feed based on AllRecentChanges can also show the pages with recently added comments. HansB
Are you sure? I posted comments and I don't see changes in the 'recent changes' pages. Anyway a "Site.RecentComments" automatic page would be a real cool addition to the recipe. Thank you and regards! h, 8/6/2006
Yes, you can check it on my site You could also post the comments onto a different page, and create a pagelist listing the latest comment posts. I did something like that with my blog pages, which show recent comments to blog entries on the rightbar. See HansB
Super, thank you... what does that page lists code for comments looks like, by the way? h, 8/7/2006

On the rightbar (on one line):

 (:pagelist group=BlogComments list=blog 
 order=-time count=10 :)

And the fmt on the BlogListTemplates page:

 pagelist of spaced blog titles for sidebar, without group heading, with simple modification date
 [[#commentsdatedtitles]](:if equal {<$Group}:)
 [-{=$LastModifiedDate} - -]
 * [[{=$FullName}#comment{=$PostCount}|{=$BlogTitle}]]
 (:if equal {>$Group}:)
Super, thank you. Now, how can I get that but without having comments in different pages than the articles / texts are? One option, I guess, is to have a comments page included from another page. Any better ideas? h, 8/8/2006.

I've done exactly that for the blog pages: including the blog comments page on the blog page, and vice versa the blog page on the blog comments page. HansB

Is it possible to extend the form, so that you also can add location, homepage, icq#, skypename, etc? flox May 14, 2006, at 04:01 AM

These are fairly substantial modifications, possible, but not trivial, and basically creating a new recipe. It is not too difficult to add more form fields, but the input needs to be checked to conform to the right format. And it probably will attract link spammers if you include a www field. I am not planning to work on this in the forseeable future. ~HansB
Maybe have a look at the Guestbook recipe. You might be able to build something starting with that.
Hi I'm using this, it would be great if, as flox said, you could add some extra fields. At least, please give some directions on how to modify the recipe to add an extra random field, like (say) phone, or www. Anyway extraneous links can be added in the fields by carefully inserting wiki code in the author or comments form fields. h, July 23, 2006.
I have now uploaded a version which includes an extra field for a website: commentboxplus2.phpΔ. There is no check made if entry is valid. If URL approval is in place the generated link will be checked/marked for approval. You can take it a a guide for further field additions: Basicaly you need to add an input field to the form, which in the script is in html under SDV($CommentBoxFmt.., so you ned to adhere to html for that, or create the whole form using input markup on the wiki page. The text entered gwets associated with the name of the input element, in this case 'website', which gets processed in the function HandleMessagePost, which creates th entry. $website = @$_POST['website']; associates the posted value of the field with a variable $website, and that gets used further on. Hope this helps a bit. ~HansB
Hey, thank you so much... ! h, July 24, 2006.

I wish this feature allowed to add comments without pressing the Edit link

But it does. you can add comments to a page without being authorised for editing, and without going to the edit window. ~HansB

I have added (:commentboxchrono:) to the GroupFooter of certain groups on my site, but I want to suppress the comment box on certain pages of those groups on a per-page basis. Is there an easy way to do that please? - Leon (6 May 2006)

The easiest way would be to include on pages you don't want the commentbox the markup directive (:nogroupfooter:) . -- HansB
That works great! Thanks very much, Hans! - Leon

  1. It'd useful to fill page summary (like "Comment added") to let readers know (in RecentChanges) what change has been made.
    Added to the sript. -- HansB April 24, 2006, at 09:06 AM
  2. When certain comment is manually deleted then next comment gets already used anchor number. Roman 2006-04-24
    Deleting the last comment(s) is okay. If you delete any other comments but the last you would need to edit the comment anchor numbers manually, to prevent duplicate numbers. The script does not check all anchors to avoid duplications, it simply counts the messages, adds 1 and creates the anchor for the new messaage. -- HansB

I have blocklist2 installed. The guestbook site needs a password to edit it ( "Bill" and "Helga" are blocked. So they shouldn'T be able to add spamm. But the head like Bill — 16 April 2006, 17:44 is added to the page. Any ideas? (PS: Sorry to annoy you :-( ) flox April 16, 2006, at 10:54 AM

Commentbox(styled).php does not to work together with blocklist.php. Words, URLs being on the Blocklist can be posted via Commentbox. This is a great thing for SPAM. :-( Is there a possibility to get commentbox(styled).php working with blocklist.php? kt007 April 05, 2006, at 03:38 PM

Use Blocklist2 instead. It handles comment posting. Neil Herber April 05, 2006, at 03:56 PM
I'm sorry? We are using blocklist2. And it doesn't work. kt007 April 05, 2006, at 05:03 PM
Be sure that you follow the instructions on Blocklist2 under the heading "installation". Your config file is probably missing the "comment" action. Neil Herber April 05, 2006, at 05:57 PM
Oh thx! We installed commentboxplus.php later then blocklist2, so the "comment" action was missing indead. kt007 April 06, 2006, at 10:16 AM
It would be cool, if the author would be a clickable link to a profile-page. flox April 15, 2006, at 01:31 PM
It is in the recent versions, by default. $MPAuthorLink = 1; does enable the author link, $MPAuthorLink =0; does disable the author link, author name will be text only. Set in config.php before including commmentboxstyled. -- HansB
Thanks. flox April 15, 2006, at 02:33 PM
Doesn't work for me... flox April 16, 2006, at 09:08 AM

It works for me with the latest release. It may not if you have $MPDateTimeFmt defined. this should work with author links:

$MPAuthorLink = 1; # optional, as it is the default in the script 

Alternatively you could try this:

$MPDateTimeFmt = "(:nl:)>>messagehead<<\n!!!!! [[~\$Author]]  &mdash;  [-\$Date, \$Time-] \n";
$MPAuthorLink = 0;  
I haven't defined $MPDateTimeFmt...but I will continue test it. flox April 16, 2006, at 10:54 AM

Hello! I'm trying to figure out how to shrink the top box of each comment. Mine come out about 3x as big as the one on the demo site. The comments themselves are fine but I have almost half an inch above and below the line of text with the author--date. Really need to fix, to save room on page. Otherwise, like this recipe a lot. Caveman

Sounds like some css issue. Is there a site to take a look at? HansB
Yes, I'm sure it's css, but I've looked in every file I could think of and tinkered quite a bit--unable to find the solution. Basically, this was the default install of the simpleforums recipe. Here's the url to a sample post. I'm using FireFox. Caveman
You need to change the margins for h5 in the messagehead. Add this to the css:

.messagehead h5 { margin:0.25em 0 0 0; }. I'll see to change the script. I overlooked this, as I use this margin setting in general for all headers with my skins. ~HansB

Glorious! Thanks Hans. I love it. In case anyone else has the same problem, put the fix in the commentboxplus script. Another question though, is it possible to change the box colors in different sections of my site (as in, with some kind of page markup, or maybe an override in the groupheader? I'd like to color code sections of my site, but don't want to bother if it would be a lot of trouble. Caveman
I updated commentboxplus.php. - To style the commentbox differently for different pages/groups: set $CommentStyles = 0; inconfig.php before the include_once line to load the script, add the css styles from the script to pub/css/local.css (for general use on all pages), and create GroupName.css or Group.Pagename.css files (replace with the actual names) with any style definitions you wish for the group or page to override the general style. For instance to set .messagehead {background:....} .messageitem {background:...}. ~HansB

I like the styled commentbox, but found the display in IE6 to be strange, perhaps due to the -1px top margin value. I changed the markup a bit to fix that, and also to use fewer <div> elements. It is posted above as commentboxplus_php.txt.

~Jefferson (01-01-06)

I updated commentboxplus.phpΔ with some border tweaks to get rid of the -1px top margin. Behaves better now with IE.
Use the following css style if message head should be same as message item (to simulate your changes):

      .messagehead { background:#eef; border-bottom:none; } 


If I enable the authuser mechanism, I am always send to an edit formular after posting a comment. The edit field contains the comment wiki code which should be appended to the page. If I click on "post" on that page, I am asked for the edit password. It seems that the ByPassAuth stuff does not work with authuser? Any solution for that? Sts - 2006-11-12

Talk page for the CommentBoxPlus recipe (users).