Kentico CMS 7.0 Developer's Guide

Defining a bad word

Defining a bad word

Previous topic Next topic Mail us feedback on this topic!  

Defining a bad word

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

The Bad words module's user interface is located in Site Manager -> Administration -> Bad words. This is where all existing bad words are listed and where new bad words can be defined.

 

devguide_clip2084

 

The top part of the page is a filter. Using it, you can display only those bad words that match the specified criteria. You can filter by the Expression and by the Action that should be taken on its detection. After specifying the filtering criteria and clicking the Show button, only those items that match the specified criteria will be displayed in the list.

 

Adding a new bad word

 

1. To add a new bad word, click New bad word (NewBadWord) at the top of the page. You will be redirected to the New bad word dialog. The following details can be entered:

 

Bad word - the string that should not appear in input text.

Bad word is a regular expression - if checked, the string entered into the previous field will searched as a regular expression.

Match whole word - if enabled, only whole word occurrences of the expression will be identified. If disabled, even words with substrings matching the expression will be identified (e.g. an occurrence of the word "document" would be reported if "cum" was defined as a bad word with this option disabled).

Action - action that will be taken in case that the bad word is detected. See the Possible actions topic for more details.

Use default settings - if enabled, global value will be used as set in Site Manager -> Settings -> Security & Protection -> Bad words -> Bad word action.

Replace with - in case the Replace action is selected, the substitute for the bad word is defined here.

Use default settings - if enabled, global value will be used as set in Site Manager -> Settings -> Security & Protection -> Bad words -> Bad word replacement.

 

Fill in the required details and click OK.

 

devguide_clip0099

 

2. Let's try the functionality now. Go to the live Corporate Site, enter the Blogs section and open some of the blog posts. Enter a comment as in the following screenshot and click Add.

 

devguide_clip0403

 

3. As you can see, the last word has been replaced with its polite substitute that has been defined earlier.

 

devguide_clip0404

 

4. You can also check the Event log in Site Manager -> Administration. An event is always logged automatically when user input containing a bad word is detected. The Event code is BADWORD in such case.

 

devguide_clip0405