Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumIs there an available word filter (profanity censorship)?...Is there an available word filter (profanity censorship)?...
Previous
 
Next
New Post
9/21/2007 1:59 PM
 

We're currently evaluating DNN as the backbone for a customer portal site and a major part of that is a user to user forum.

Obviously we don't want the place to turn into a "Saturday nite free-for-all" and I don't remember seeing a feature listed OR anywhere in the Forum module a way to add a word filter for either the forum proper or the text editor when a message is composed to help prevent profanity.

Is something like this available already in the Forum module or is there perhaps a seperate solution that can be used with the forum module?

Any info is appreciated!

-Will

 

 
New Post
9/21/2007 5:33 PM
 

A word filter is in the Admin section of the Forum Module.  There you can add and remove words to filtering.

Regards

Matthias

 
New Post
9/21/2007 10:17 PM
 

Will, we found the bad word filter with 3.20.09 did not suit our needs.  For example Assume, pass, would get changed to pfannyume and ppfanny.

A few posts bad I started a thread about the bad word filter (actually two, but that was my fault.  I made the following changes to the source so that pass, assume, for example are not filtered out. The source implementation uses a straight forward string replace.  With the use of regular expression you can hone your results. I hope the moderators forgive me if I post this solution again.  It is my hope the badword filter could really be improved. A straight forward string.replace method is not your best choice.  Here is the function that will create the Regex object for you:

Private Function BuildRegex(ByVal badWord As String) As System.Text.RegularExpressions.Regex

            '***************************************************************
            '09-17-07 improvement to bad word filter via regular expressions
            'for more precision - jfs.
            Const RegexMetaCharacters As String = "(\[|\\|\^|\$|\.|\||\?|\*|\+|\(|\))"

            Dim filter As StringBuilder
            Dim exp As String = String.Empty
            Dim wordCapture As String = String.Empty
            Dim rx As Regex = Nothing

            '(?i)([^a-zA-Z<>&;\s]BADWORD[^a-zA-Z<>&;\s]|\bBADWORD\B)
            If (Regex.IsMatch(badWord, RegexMetaCharacters)) Then
                wordCapture = Regex.Escape(badWord)
                '
                filter = New StringBuilder(50)
                filter.Append("(?i)([^a-zA-Z<>&;\s]")
                filter.Append(wordCapture)
                filter.Append("[^a-zA-Z<>&;\s]|\b")
                filter.Append(wordCapture)
                filter.Append("\B)")
                '
            Else
                '(?i)([^a-zA-Z<>&;\s]BADWORD[^a-zA-Z<>&;]|\bBADWORD\b)
                wordCapture = badWord
                '
                filter = New StringBuilder(50)
                filter.Append("(?i)([^a-zA-Z<>&;\s]")
                filter.Append(wordCapture)
                filter.Append("[^a-zA-Z<>&;\s]|\b]")
                filter.Append(wordCapture)
                filter.Append("\b)")
                '
            End If
            '
            exp = filter.ToString().Trim()
            '
            Return New Regex(exp)
            '

End Function

 

Then with the two functions in the WordFilterController, I do this:

 

objFilterWord = CType(colFilterWord.Item(intCount), FilterWordInfo)
                    '
                    If objFilterWord.CreatedOn > TimeStamp Then
                        '
                        Dim rx As Regex = BuildRegex(objFilterWord.BadWord)
                        '
                        If (rx.IsMatch(Text)) Then
                            Text = rx.Replace(Text, objFilterWord.ReplacedWord)
                        End If
                    End If

 

This will avoid inadvertant replacements and possible attempts to subvert it.  For example,

BADWORD

_BADWORD7

7BADWORD!

"BADWORD"

$BADWORD!,

and not eat up white space around it so that a replace inadvertantly concatenates the previous or following word.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumIs there an available word filter (profanity censorship)?...Is there an available word filter (profanity censorship)?...


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out