Summary: Talk page of Fox Forum

Back to FoxForum

Discussion, comments, questions etc. about FoxForum

Put your latest comment at the top please!

27/02/10 SCV

Hi thanks for a great recipe.

Is there a way to prevent a visitor from posting. (Allowing only registered user to post once they have logged in). I have set the $FoxAuth to read but had no effect as mentioned lower down in this discussion.

Set $FoxAuth = 'edit'; so only edit authorised users can post. - HansB February 27, 2010, at 09:00 AM

27/04/2009 JHJ
Topic Subjects and not good page names as they tend to be too long, include special characters and are therefore sometimes rejected by the servers. How can I make the Topic PageName numeric using {$$(serialname xxx xxx } so the blog becomes more stable and userfriedly?

19/04/2009 JHJ
Did an error slip into foxforum during a recent release? Line 136 in foxforum.php sets the type to standard. This means you cannot create extended forums at all.

3/23/2009 Cyril

I have installed FoxForum and created a new forum using FoxTemplates.CreateNewForum.

The forum looks ok (it even has a Welcome message) but when I create a new topic and go in it, I see :

(::subject001:Rien::) (::message001: yes we did ::) (::subject001:Est-ce que ca marche ?::) (::message001: non ::) 

rather than the expected content.

And if I try to create another topic, I get the followin error: 'Page name from filter exists already. Please choose another page name!'

Any idea?

Thanks for this cookbook and fox in general!

actually I was using FoxTemplates.CreateNewForum to create my new forum and it seems it does not copy (or it failed to) Sample-Forum.php in local/ to the new forum name (ex. ''local/MyForum.php'). I did this manually and everything worked afterwards !!

16.2.09 WalterD I guess you did not see my comment below, so I put it on top.

This is what I get with my first topic:

  1. post{$$FoxCount} Post: {$$editlink} {$$deletelink}

by {$$author} on {$$date} {{$$subject}}

Although in the main page everything seem right: Topic 1 topics Posts Last Posted By testforum 1 February 08, 2009, at 09:54 PM EST wd

I use the standard group forum and as required renamed sample-forum.php forum.php (in local). So there should be no further configuration. You mentionned, that probably foxforum is not installed in local path, but it is.

This are my entries in local/config.php: $FoxPagePermissions['Forum*.*'] = 'add,copy'; include_once("$FarmD/cookbook/fox/foxtemplates.php"); include_once("$FarmD/cookbook/fox/fox.php"); include_once("$FarmD/cookbook/fox/foxdelete.php"); include_once("$FarmD/cookbook/fox/foxedit.php"); include_once("$FarmD/cookbook/fox/foxforum.php"); $FoxPagePermissions['nhForum.*'] = 'all';

I verified and reverified, but can not get to any better result. Do you have any other idea? I use AuthUser. Could this be the reason? WalterD WalterD

Sorry, i am still thinking about this. AuthUser should not pose a problem. The fact that you can see replacement variables "raw" without values suggest to me that the display template is not being picked up. Display templates are in FoxTemplate.DisplayTemplates. Can you access that page at all? If you cannot navigate to FoxTemplates/ there is a fault with the additional pagestore the forum uses, and which is defined in foxtemplates.php. The page files should be in directory cookbook/fox/templates.d/

If you can see FoxTemplates.DisplayTemplates as a wiki page then check if you got a ForumConfig page. In addition i advise to put include_once("$FarmD/cookbook/fox/fox.php"); last in the list of fox files to include, and put any $FoxPagePermissions before, otherwise Fox won't see them.

Lastly, there may be an issue with the (:include :) markup. Make sure you have the latest PmWiki version 2.2.0 installed! - Hope this helps! HansB

Thank you for the feedback. I now installed last pmwikiversion from feb, 19th 2009, but still have the same problem. I can see foxtemplates.displaytemplates (but variables also in "raw" format) and also have I also have the inclusions as recommended (fox.php last). As mentionned i did not change the name of the forumgroup. WalterD


Hello Hans, I've installed FoxForum and love the result. The problem I have is that when a user wishes to post a comment, he is then prompted by pmwiki for a password. I have put a password on my whole site, using $DefaultPasswords['edit']='...'; but I thought that the $FoxPagePermissions['Forum.*'] = 'all'; line would take care of that.

If I set my Group edit password to @nopass then anyone can do anything in the group, and I don't want that. Am I missing something?


Jim M.

Set in local/Forum.php $FoxAuth = 'read'; (there is a commented line in the file) - HansB February 16, 2009, at 05:31 AM


Can you explain what (:input hidden csum 'New Topic added':) does in the Create a New Topic form? I can't see where csum is used. Also I would like to have RSS updates each time a New Topic is created - could you help advise on how this might be achieved? Thanks.

csum is used by RecentChanges pages as a change summary entry. Look at a Forum's RecentChanges page and you see. For RSS have a look at WebFeeds. Basically you set up the web feed subscription link as the url link to the Forum's RecentChanges page (as the trail page) with ?action=rss added as parameter. - HansB February 10, 2009, at 05:36 AM

6.2.2009 I installed For forum and called my forum group "forum". My first posts and the 'add comment' bos show up 6 times with no edit- or deletelinks. The foxcount value and the date do not show either. I use authuser. How do I have to transform your code to make it work? I use the latest pmwiki-version.

This is what I get in the posts:

  1. post{$$FoxCount} Post: {$$editlink} {$$deletelink}

by {$$author} on {$$date} {{$$subject}}




Probably foxforum.php is not installed. It should be installed by a Forum.php file in the local/ directory. Forum.php should be the exact name of your forum group (it is a Local Customizations file). You also need to check the settings in this file. HansB

(3-Oct-2008) Fox Forum Right-to-Left.
I am trying to create an Arabic forum using Fox Forum. As with most recipes, there is plenty of adjustments to make, but I have not managed to make the topic generation work. The pages are created with arabic titles, and the topic is visible in the main forum page, but the text its not readable.

It seems some letters of the alphabet, like the 'mim' (م), are causing problems when included in the topicname, causing the main text to come out as {�ال.ForumAr}. If I type a subject with latin letters, the page works fine.

Do you have any suggestions on how to make the forum work better with rtl languages? (I guess the easiest fix would be to give an alternative name to the topic pages, based on FoxCount, for instance, instead of the subject typed in Arabic.) - Regards, VG.

I am out of my depth here, never had any experience with RTL or arabic. Perhaps the best is to modify the form creating new topics, so that perhaps a purely number based name is used, or a ISO-date and number combination. Then have the arabic topic as input for the page title. For serial names generated through a markup expression please see PowerTools#serialname. For apurely numeric page name I think the form of Forum.CreateNewTopic could have instead of

(:input hidden target {$$topicpage} :)


(:input hidden target {$$(serialname)} :)

and in the (:fox....:) markup set redirect=1 (not $$topicpage), remove parameters foxgroup=... and pagecheck=... Pagecheck is not necessary, as the new target page is always an incremental from the previous one, so an existing page will not become target for a new topic page.

 - HansB

Thanks! This works nicely. However, I have a few other difficulties getting the forum working smoothly. Maybe you have some ideas what might cause this:

  • On the topic page, deletelinks are translated for comments but not for topic post. The display template look the same for both. The comment editlink is also biggger than that of the topic, but both translate without problems.

There appears to be a bug on page FoxTemplates.FormTemplates section #newtopic:
please replace in the (include ...:) markup
deletelink="{[foxdelrange Delete Topic]}"
deletelink="{[foxdelrange '$[Delete Topic]']}"
which lets you use a XL page to translate the string 'Delete Topic', or just use your own string, but make sure it is in single quotes. - HansB

  • Clicking on the editlink just brings up an empty subject and textbox.Edit: downloading the latest version of fox.php fixed this problem.
  • Previews are not working, displaying a box with (:foxpreview:) inside, and the template text beneath. Example for the editform: (:foxpreviewtemplate “{$$ptv_subject001} \n----\n\n{$$ptv_message001}”:) . My Blog (blogsimple.php) shows some similar behaviour, with a (:nogroup:) markup visible on the main page. Is there a recipe I am missing or something? Edit: downloading the latest version of fox.php fixed this problem.

Cheers, VG.


When a new topic is created, then the topic does not automatically become the new subject. The first item on the comment page therefoe has no subject before it is edited. How can I make the topic to show up as a default subject? Replacing {{$$subject}} by {*$Namespaced} in the display template fixes it, but it that the idea? Latest release - JHJ

I thik the best may be to edit the page FoxTemplates.FormTemplates section #newtopic, and replace (::subject001:::) with (::subject001:{$$topic}::), which will insert the topic subject as the 'subject' ptv. Maybe I should make this the default. The reason I did not do this is that I did not wish to duplicate the topic as page title in the 'subject' field. The display configuration can of course suppress the subject field, not showing it, but using the normal edit form will show a subject field. This could be suppressed as well, with a conditional on the post number, not showing the subject input field for post 001. But I had avoided too much complexity in the forms, they are very high already. - HansB July 04, 2008, at 01:30 AM

(5-July-2008) Thanks! This works fine for my context now. However, in the main forum display I also changed [[{=$FullName}|'''{=$Titlespaced}''']] to [[{=$FullName}|'''{{=$FullName}$:subject001}''']] so that the changed subject is reflected in the forum topic. I needed this fix because when users enter a new topic, they sometimes make spelling and other mistakes. They then want to back and correct them. With these changes this is possible although the error still remains in the now invisible file name. JHJ, July 06 2008


Is it possible to enable preview for FoxForum so that I can preview my post before I submit it?

- Daniel

It is not possible at the moment. I will think about if it could be done. - HansB June 30, 2008, at 10:02 AM UPDATE: Now possible with latest release! - HansB July 03, 2008, at 05:55 AM

Great! Thank you very much! - Daniel


I am getting the following errors when I try to edit a test comment or an original topic entry:

Warning: Wrong value for parameter 4 in call to preg_match_all() in /home/asterisk/html/cookbook/fox/fox.php on line 783
Warning: Wrong value for parameter 4 in call to preg_match_all() in /home/asterisk/html/cookbook/fox/fox.php on line 792

Fatal error: [] operator not supported for strings in /home/asterisk/html/cookbook/fox/fox.php on line 641

Has anyone run into anything like this before?


What version? Try the latest fox.phpΔ - HansB June 17, 2008, at 04:10 PM



it seems TableEdit has the same problem as SectionEdit. Do you know of any way to fix this problem?

Thank you very much,


You are right. Both recipes manipulate the (:include:) markup, and this breaks FoxForum. Make sure TableEdit is not included for the Fox forum group. - HansB

I added this code to my config.php:

$page = PageVar($pagename, '$FullName');
$group = PageVar($pagename, '$Group');
if($group!='Forum') {

It works perfectly now. Thanks!



Hi Hans,

just found out that FoxForum got some problems with SectionEdit. Creating new topics works fine, but the site for a topic just comes up with some Variable-names ($$author, etc.) rather than their content. However, if I comment out sectionedit.php in my config file, all works fine.

Besides that, enabling sectionedit and setting its configuration to "$SectionEditInIncludes = false;" again works, although the Author's name now shows up in '\"'.

Thanks, Tobias

My guess is that SectionEdit has a problem with the (:include:) markup as used by FoxForum. SectionEdit does some text manipulations with included text. FoxForum uses (:include:) in a very sophisticated way, by including the same page (the display template) multiple times once for each message), and replacing replacement variables in the template page with values given in the markup. Note that this use is totally legal. I recommend to use FoxEdit for individual message editing. HansB February 27, 2008, at 03:42 AM


Is it possible to alternate the colors of the forum topics? I find that having alternating colors makes it much easier to read a forum.

it is possible, but requires some modifications to a number of templates and the css. The basic idea would be this: when posting a comment the template which is used will insert an extra 0 or 1 after the {$DisplayCommentTemplate} var. This number is returned with a markup expression checking the $FoxCount var number and return 1 for odd numbers, 0 for even numbers. The DisplayTemplates need modifications, basically doubling each one and changing the anchors: [[#default0]], [[#default1]] etc., then changing the class names and changing the css sheet accordingly. The markup expression required is this:

$MarkupExpr['isodd'] = 'is_odd($args[0])';
function is_odd( $int ) {
  return( $int & 1 );

and the change for the form template FoxTemplates.FormTemplates#comment is {$DisplayCommentTemplate}{$$(isodd {$$FoxCount})} (adding the markup expression).

This solution is working, but I am not prepared to make the changes to the distributed forum, as it makes it even more complex. I hope you can do it yourself with these hints! HansB February 09, 2008, at 06:14 AM


Hi Hans,

I installed the standard version and it was working fine. There's a problem with creating new topic. Every new topic is named Forum.SpanSpanTopicpage regardless of the topic name. This causes a problem when I try to create another topic as it overwrites the first topic. I made no changes in the files or configuration.

Edit: I guess there's some conflict with totalcounter package I installed. Disabling it makes the thing work again.

Thanks Max


Hi Hans, I've just installed a standard version i.e. no forum name changes, using etc. but with no captcha. New top and post all work fine but when I try to delete anything I get an Object Not Found 404 from trying to find "hxxp://usfosmesproj01/wiki//Forum.PilotProduct?action=foxdelete....."

Note the double / after "wiki" i.e "...j01/wiki//Forum..."

On all other pages with my Apache setup I see urls in the form "hxxp://usfosmesproj01/wiki/?n=Forum.PilotProduct" i.e. with the ?n=.

Any suggestions?

John Oakley

you can either configure your wiki to use clean Urls (see CleanUrls) or edit fox.php in this way: In the function FoxDeleteMarkup the line where it says return FmtPageName("<a class='foxdellink' change href='{$ScriptUrl}/{$targetname}?action=foxdelete... to href='{$PageUrl}?action=foxdelete... I will correct this in the next release. HansB December 20, 2007, at 02:30 PM


Hi Hans,

it seems to me that there is a numbering problem, if 2 users are reading and writing at the same time.

Topic 1 has two comments => comment counter is 2
User A reads topic 1
User B reads topic 1
User A writes a comment => comment User A is stored with comment number 3
User B writes a comment => comment User B is stored with comment number 3

If someone reads this topic 4 comments are shown. The last 2 comments both have number 3 and both have the text of user B. The authors name is shown correct, but number and text are shown twice.
Other examples are possible. Always the number of the first and the text of last of the conflicting postings are shown twice.

In the source file it seems to me, that everything except the number is stored correct. But the number is doubled.
Is the number for a new post calculated when reading the post? Than a fix could be to calculate the number when writing the post. Another, but dirty fix could be to show the text similar to the authors name, not depending on the number, but depending on the position in the source. But this could show side effects, because the numbering in the source will be wrong. The better fix in my view would be to avoid double numbers.

I have tested it with the last version.


Your analysis is correct. The count is taken from a page text variable FoxCount, and incremented, and this is used for the comment post. The value used is the one read when the page is loaded, so yes in can be out of date, and should be read when the post is processed. Not sure how to do this right now. I used to not use a page text variable as counter, but write a var directly as a page attribute. HansB December 19, 2007, at 01:03 PM

Remedy: change in foxforum.php function FoxCountFilter to this:

function FoxCountFilter($pagename, $fx) {
      $fc = PageTextVar( $pagename, 'FoxCount');
      $fx['FoxCount'] = sprintf("%03d",$fc+1);
   return $fx;
} //}}}


Broken version?

Is something broken in recent versions of Fox and FoxForum? I get the error

    ERROR: 'n' is not a legal field name.

with FoxForum straight out of the box, and had the same problem when trying to set up a basic Fox and ToDo recipe. -- krisku

I do not see any problem regards being broken. Make sure you use a (:fox formname ...:) markup, as it does not use the 'n' parameter. If you use a normal form: (:input form...:) and (:input hidden action foxpost:) and (:input hidden n {$FullName}:) you will get the error you describe. Yes and do not use 'n' as a field name! It is just a little security measure. The code regards to it has changed slightly, so I wonder if it is actually better now. Please let me know if you used 'n' as field name. code is on line 185 ca in fox.php. You could just comment it out there all else failing. HansB December 05, 2007, at 03:14 PM

(7-Dec-2007): I just found an explanation for the problem. I had set up my wiki to use the CleanUrls recipe using URL rewriting and the RewriteRule turned the referenced page name into a ?n=$1 query string. When I reconfigured my Apache to use mod_alias instead, I got rid of the "'n' is not a legal field name" problem... -- krisku

Oh thanks! This is a bug then! I accidentally introduced it with adding a new FoxRequestArgs function, which did merge input from $_POST and $_GET. I have limited this back to only use input from $_POST form submissions, and excluding the 'n' field name, till I am clearer about the security issues surrounding allowing input from url queries (i.e. php $_GET). Updates uploaded. HansB December 07, 2007, at 03:23 AM


Two shell scripts that you may find useful - and

This section will only work for linux/unix users with access to the command line. Windows users could maybe develop a similar script as a .bat, BASIC or java file.

Don't forget to make your scripts runnable:

$ chmod a+x

This script will make the changes needed to make another forum. It takes template files that you create and modifies them to make the new forum.

# use from the command line
# ./ NewForumName


if [ $1 = "" ] || [ $1 = ${source} ]
        echo "No argument given or trying to copy the template file to itself"
        exit 1
        echo "Using $1"
        cp ${source}.CreateNewTopic $1.CreateNewTopic
        cp ${source}.Forum $1.Forum
        cp ${source}.ForumConfig $1.ForumConfig
        echo "Running sed on $1.php"
        cat ${source}.php | sed "s/${target}/${1}/g" > ${1}.php

Before you use it you need to do some setup. You only need to do these steps once:

Setup Step 1: Copy these files, rename them, and put them into the same folder with the script:
filenamerename to
Setup Step 2: Modify this line in zTemplate.php

$FoxPagePermissions['Forum.*'] = 'all';

  • change it to:

$FoxPagePermissions['XTemplate.*'] = 'all';

  • Note it is XTemplate, not zTemplate.
Note: Case does matter!!

Now you are ready to make a new forum

Step 1: Run the script and pass it the name of the new forum name. For example: ChessForum
  • ./ ChessForum
  • Now you will have these files:
    1. ChessForum.php
    2. ChessForum.CreateNewTopic
    3. ChessForum.Forum
    4. ChessForum.ForumConfig
  • And the ChessForum.php file will have:

$FoxPagePermissions['ChessForum.*'] = 'all';

Step 2: Move the files to the correct folders
  • The .php file goes in your local folder.
  • The other files go in the wiki.d folder.

In this example:

fileGoes in folder
Step 3: Add a link to the forum to a wiki page.

In this example something like: [[ChessForum.Forum | Chess Forum]]

Thats it!

Now to make another forum you can simply:

  1. run ./ NewForumName
  2. move the files to the correct folders
  3. add the link to a wiki page



This script will help make the changes to upgrade foxforum from the pre 2007-10-22 releases to the post 2007-10-22 releases. This script uses the steps listed in the "Upgrade Note" in the "Release Notes" section of the Cookbook.FoxForum page.

# use from the command line
# ./ FileName

r3='subject={$FullName}$:subject000 text={$FullName}$:comment'

if [ $1 = "" ]; then
        echo "No argument given"
        exit 1
        cp ${1} ${1}.old
        echo "Upgrade file $1"
        cat $1        | sed "s/$t1/${r1}/g" > ${1}.test
        cat ${1}.test | sed "s/$t2/${r2}/g" > ${1}.test
        cat ${1}.test | sed "s/$t3/${r3}/g" > ${1}.test
        rm ${1}
        mv ${1}.test ${1}

The script looks in the forum.topic file for three target strings (t1, t2, and t3) and replaces them with three replacement strings (r1, r2, and r3) respectively.

Pass it the name of the forum you want to upgrade. An example would be upgrading your old ChessForum.Forum. Imagine that someone had posted a discussion about opening moves: ChessForum.Openers

To run the upgrade script you would type:

  • ./ ChessForum.Openers
  • The script must be in the same folder as the Forum.
  • This script adds .old to the original file name so that you can try it out first. The steps might look like this:
  1. Run the upgrade script: ./ ChessForum.Openers
  2. Test the upgrades in your wiki by viewing and refreshing the forum page(s)
  3. If you like the changes then delete ChessForum.Openers.old
  4. if you don't like the changes then:
    1. delete ChessForum.Openers and
    2. rename ChessForum.Openers.old back to ChessForum.Openers and
    3. things will be back as they were:


(19-August-2007) I got ForumX working nicely, but the topic display always returns one non-existing topic at the very bottom of the page. It looks like this: {=Full Name}? 0 {=$LastModified} {=$LastModifiedBy}. It is generated by the pagelist [[#forum]] template. How to eliminate it? JHJ.

Have you enclosed the forum pagelist template in a >>comment<< division? - HansB
Yes, but it appears that the current release of ForumX is incompatible with the cookbook script AdvancedTableDirectives.php. Removing this script fixed the problem. JHJ, August 26

(20-October-2008) Since this still isn't fixed, a workaround, if your forum happens to have the word "Forum" in the url, is to conditionalize the table directives include:

if (!preg_match("/Forum/", $pagename ))

(16-July-2007) I want to usecreate the Index Page to show all existing Topics but I can't find any hinstruction how to create the mentioned Index Page. please help Leftaf?

There is a Forum.Forum and a ForumX.ForumX index page included in the zip in foxforum/wikilib.d. Copy the relevant pagelist markup plus template if you need it on a different page. HansB July 18, 2007, at 11:45 AM

(29-June-2007) If you configure the forum for 20 posts per page - what happens to post #21? ~Matt

It will show on page 2. Links to all pages are shown on all pages. HansB July 18, 2007, at 11:45 AM

(25-June-2007) We're getting hit by the spambots but so far the "number verification" is holding up. Unfortunately, even if the poster doesn't enter the correct number, the thread's "last posted by" is shown as the poster's name and the datestamp (hence ordering) is revised. Is there any way we can prevent this? -- JLuk

I think this could be caused by the foxptvreplace filter function. You may try this untested modification of foxptvreplace.php: add inside the function FoxPTVReplace before the line starting with FoxPagePermissionCheck:
FoxSecurityCheck($pagename, $fields);
This should run all security checks including access code check before the main ptv replacing, thereby aborting the operation if an error occurs, instead of doing the ptvreplace bit, and aborting later. If this works I should add it to the code in the distribution. HansB July 18, 2007, at 11:45 AM

(12-June-2007) Tip: make sure you don't have an anchor named #forum on your page, because that is also the name of the default pagelist format style!! Took me hours to figure out why my page wasn't displaying!

Also, a few bug reports:

  • The escape sequence used to close the post is, unfortunately, a very commonly used smiley :) ... if a user enters the smiley, the post is closed off at that point. Is it possible to somehow escape that sequence? Even translating it into another kind of smiley should be an okay temporary fix.
  • (a minor one) if the user enters the wrong access code, the message is rejected but the counter still increases. -- JLuk

(9-June-2007) (Bug report deleted as it was fixed in the latest version. If you're curious, see the History. Thanks, HansB! We are now running a site for 400-member alumni association using your FoxForum.) -- JLuk

Hallo! Above is spoken about pub/ files but contains only local and cookbook directories?
Next using Forum a first time I get PERMISSION DENIED to edit Forum.FirstTitle! trying to get a page "FirstTitle" (test).
PKHG 070517:1332

Did you copy local/Forum.php to your local/ directory? local/Forum.php contains the local customisations for the forum, for group Forum, including the $FoxPagePermission setting. If you use a different group, you need to rename the file and change this setting. - The referenc eto the pub/ folder was outdated, sorry! I removed it now. HansB May 17, 2007, at 02:50 PM

Talk page for the FoxForum recipe (users).