SilverStripe Mollom Module 0.2 ======================================= INSTALLATION ------------ 1. Unzip this file (mollom-0.2.tar.gz) inside your SilverStripe installation directory. It should be at the same level as 'jsparty', 'cms' and 'sapphire' modules. 2. Ensure the directory name for the module is 'mollom'. 3. Visit your SilverStripe site. 4. Add db/build to the end of the website URL. For example: http://localhost:8888/mysite/db/build. 5. We now need to setup some basic features to get the module up and running. Open up _config.php inside Mollom module directory ('mollom/_config.php') with your favourite text editor. Read the instructions below to setup the initial configuration of the module. SETTING UP THE MOLLOM API KEY (in 'mysite/_config.php') ------------------------------------------------------ Copy this code into your mysite/_config.php file, and eplace the strings "enter-your-mollom-public-key" and "enter-your-mollom-private-key" with the public key and private key you obtained from Mollom (http://mollom.com/) Mollom::setPublicKey("enter-your-mollom-public-key"); Mollom::setPrivateKey("enter-your-mollom-private-key"); SpamProtectorManager::set_spam_protector('MollomSpamProtector'); What does this do? ------------------ This tell 'SpamProtection' module that you want to use 'MollomField' as a spam protection module across your site, and set up the public and private keys that are required for the module to interact with Mollom service. SETTING UP A FROM WITH A MOLLOM FIELD ------------------------------------- Suppose you create a contact form in a page type called 'ContactPage.php' (in 'mysite/code') <<<< CODE STARTS >>>> /** * Sample contact form */ function ContactForm() { $fields = new FieldSet( new TextField("Name", "Name"), new EmailField("Email", "Email"), new TextField("Website", "Website"), new TextareaField("Content", "Message") ); $actions = new FieldSet( new FormAction('doContactForm', 'Submit') ); $form = new Form($this, "TestForm", $fields, $actions); // Update the form to add the protecter field to it $protector = SpamProtectorManager::update_form($form); // Tell the module to use Title, Message, Name, Website, Email fields // as post title, post body, author name, author url, and author email, respectively, // to do spam checking against Mollom service if($protector) $protector->setFieldMapping('Title', 'Content', 'Name', 'Website', 'Email'); } <<<< CODE ENDS >>>> What does this do? ------------------ This setup a contact form with a mollom field. When page first loaded, it displays a normal form without the protector field. After user fills the form and submits it, the content of the form is sent to Mollom service for spam checking. If Mollom service verifies that the submission is not a spam, the control will pass on to doContactForm() function. If the service says the submission is a spam, user will be redirected to the homepage without further processing with the form data. On the other hand, if the service is not sure whether the submission is a spam or a ham, user will be presented with Captcha image and audio and a text field for issuing the Captcha solution.