FoxCommentBox-Talk

Summary: Talk page for FoxCommentBox.
Maintainer: HansB
Users: (View? / Edit)

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

Comments

Is there a way to filter the comments so if there are say more than two links you don't post? I have captcha and honeypot enabled, but it is not enough, and usually the spammers post with gobs of links...

HansB: you could try using a Fox filter function to prevent such posts. Here is a very crude one, which counts occurrences of http: and www.. Note that the PHP function substr_count does a case sensitive search, so you may want to extend the filter still. It also does not check if such search terms are within double square brackets. Add the code somewhere in config before you include fox.php.

$FoxFilterFunctions['blocklinkspam'] = 'FoxBlockLinkSpam';
function FoxBlockLinkSpam($pagename, $fields) {
	$http = substr_count($fields['comment'], 'http:'); 
	$www = substr_count($fields['comment'], 'www.');
	$cnt = $http + $www;
	if ($cnt > 2) Redirect($pagename);
  return $fields;
}

To use the filter function in your comment form, add to it:

 (:input hidden foxfilter blocklinkspam:)

Page with form

(:if ! exists {*$FullName}-Comments:)No comments for the moment(:if:)

(:include {*$FullName}-Comments :)

(:fox formComment:)
(:if ! exists {*$FullName}-Comments:)
(:foxadd Site.FoxTemplate-FirstComment=>{*$FullName}-Comments :)
(:if exists {*$FullName}-Comments:)
(:foxadd Site.FoxTemplate-Comment=>{*$FullName}-Comments :)
(:if:)
(:foxcheck comment msg='You must post a comment' :)
(:foxcheck author msg='You must post an author' :)
(:foxmessage formComment comment :)\\
(:foxmessage formComment author :)\\
(:input textarea comment rows=3 cols=60:)\\
Author : (:input text author value='{$Author}' size=30 :)\\
Enter value {$Captcha} (:input captcha:) <- Captcha\\
(:input submit post value='Post':)
(:foxend formComment:)

Page Site.FoxTemplate-Comment

#foxbegin#
(:div1 class=messagehead:)
>>rfloat<<   
[-{$$(date d.m.Y - H:i)}-]
>><<
!!!!!{$$author}
(:div1end:) 
>>messageitem<<
{$$comment} 
>><<
#foxend#

Page Site.FoxTemplate-FirstComment

!Comments (directive foxprepend must have a text before !!)

(:foxprepend formComment:) (warning : no space before the name of the form)

#foxbegin#
(:div1 class=messagehead:)
>>rfloat<<   
[-{$$(date d.m.Y - H:i)}-]
>><<
!!!!!{$$author}
(:div1end:) 
>>messageitem<<
{$$comment} 
>><<
#foxend#

This is perhaps a misunderstanding. The first word in the (:fox :) markup directive after fox is the name of the form. For instance in (:fox cbox ...:) cbox is the form name. Directive (:foxprepend:) can catch output from this form only by using (:foxprepend cbox:). In the example above formComment is the name of the form, not Comment. HansB December 05, 2008, at 04:05 PM


When the Variable $EnablePostAuthorRequired = 1; is set a comment can be posted, even when no autor is entered. Is there a way to still force entering of an author name? Klonk November 14, 2011, at 09:46 AM

don't know how to use this, Can I put a comment box to every wiki page?


If you have lots of spam caused by robots, you can use a honeypot (as soon the invisible field is filled with something the input is not accepted). Simply add the following top your form (The text is only used to confuse the robot):

%comment%(:foxcheck code if='equal {$$code} ""' msg='Wrong Code!':)Code: 5 + 2 (:input text code value='' :)(leave empty!) (:foxmessage code:)%%

Klonk November 23, 2013, at 02:41 AM

Talk page for the FoxCommentBox recipe (users?).