Creating a moderated comments systemHere’s a quick trick that will make life easy when you want to keep control over what is be added to your site. I’m going to skip over the basic Content Management approval controls, which are documented elsewhere, and look at the form-based techniques that give you even more flexibility over your approval processes. Let’s start with a simple typical scenario – a blog with a comments section, where you want to allow anyone to post a comment, but you want to approve (ie moderate) the posting before it shows up on the site. Later on we’ll extend this example to more complex setups, but this will explain the fundamentals. So, for our blog, the comment postings will be stored in a neatComponents Form – with the usual fields of Comment text, Date, Posting (that it refers to), and so on. The trick is to add a checkbox field, called say ‘Publish’, which is unchecked by default. Then, when the Query that displays the comments is embedded on the page, add a criteria to only show records where the Publish checkbox field is checked. Naturally it’s important that (a) the writer of the comment doesn’t see the Publish checkbox – or they could approve their own postings(!), and (b) the site administrator does get to see the Publish checkbox, to approve them. This is achieved by using two Data Entry Forms, both linked to the same underlying Comment Form. The first one is public facing, and doesn’t contain the Publish checkbox, whilst the other does show it, and has its Permissions set to only allow the site admin to access it. For added sophistication it’s a trivial step to add an email to the Public Data Entry Form that sends the admin an email to alert when a comment needs moderating. In my next posting I’ll be building on this simple example to look at scenarios where an item (probably not a blog comment, but, for example, a Press Release) needs to be approved by several people. For those of you familiar with the free clearString system, it goes without saying that all this configuration is done without writing a single line of code, without any Linux haikus, and without breaking a sweat. If you’re new to the system see www.clearstring.com
|