2017 © Pedro Peláez
 

silverstripe-vendormodule akismet

Akismet antispam module for Silverstripe

image

silverstripe/akismet

Akismet antispam module for Silverstripe

  • Monday, June 18, 2018
  • by tractorcow
  • Repository
  • 12 Watchers
  • 1 Stars
  • 26,023 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 7 Forks
  • 2 Open issues
  • 17 Versions
  • 15 % Grown

The README.md

Akismet Silverstripe Module

Build Status Scrutinizer Code Quality codecov SilverStripe supported module, (*1)

Simple spam filter for Silverstripe using Akismet, (*2)

Also, please report any issues you may encounter, as it helps us all out!, (*3)

Please see the changelog for module history., (*4)

Credits and Authors

Requirements

Installation Instructions

This module can be easily installed on any already-developed website, (*7)

  • You can install using Composer, as below:
composer require silverstripe/akismet ^4.0

AkismetSpamProtector is automatically assigned as the default spam protector class., (*8)

  • Get an API key from akismet.com and set in the site against one of the following ways.

config.yml:, (*9)

---
Name: myspamprotection
---
SilverStripe\Akismet\AkismetSpamProtector:
  api_key: 5555dddd55d5d

_config.php:, (*10)

use SilverStripe\Akismet\AkismetSpamProtector;

AkismetSpamProtector::singleton()->setApiKey('5555dddd55d5d');

.env:, (*11)

SS_AKISMET_API_KEY="5555dddd55d5d"

If instead you want to configure your akismet key via the siteconfig (as a password field) you can add the included extension to SiteConfig, (*12)

mysite/_config/settings.yml:, (*13)

SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - SilverStripe\Akismet\Config\AkismetConfig

Priority of defined API keys

Please note that the API key values defined in the various ways above will be prioritised as:, (*14)

  1. Values assigned to the singleton via AkismetSpamProtector::singleton()->setApiKey()
  2. Values defined in configuration, whether YAML or in _config.php files with Config::modify()->set(...)
  3. Values defined in the environment via .env

Testing

By default, spam protection is disabled for users with ADMIN priviliges. There is also an option to disable spam protection for all logged in users. In order to disable this for testing purposes, you can temporarily modify these options in your development environment as below:, (*15)

use SilverStripe\Akismet\AkismetSpamProtector;
use SilverStripe\Control\Director;
use SilverStripe\Core\Config\Config;

if (!Director::isLive()) {
    Config::modify()->remove(AkismetSpamProtector::class, 'bypass_permission');
    Config::modify()->remove(AkismetSpamProtector::class, 'bypass_members');
}

In order to check that your form is blocking spam correctly, you can always set 'viagra-test-123' as the author and Akismet will always mark this as spam., (*16)

Comments

If you're using Comments module you can quickly set akismet to filter these out by adding the CommentSpamProtection extension to the CommentingController, (*17)

config.yml, (*18)

SilverStripe\Comments\Controllers\CommentingController:
  extensions:
    - CommentSpamProtection

If necessary, you can also mark spam comments to be saved to the database. This will still display the spam rejection notice, but spam comments will now be available for moderation in the backend. In order to enable this feature add the following to your configuration., (*19)

config.yml, (*20)

# Allows spam posts to be saved for review if necessary
SilverStripe\Akismet\AkismetSpamProtector:
  save_spam: true

Custom Form Usage

To enable spam protection in your custom forms, call the enableSpamProtection method with your field names mapped to the akismet fields:, (*21)

$form  = new Form($this, 'Form', $fields, $actions, $validator);
$form->enableSpamProtection(array(
  'mapping' => array(
    'Name' => 'authorName',
    'Email' => 'authorMail',
    'Comments' => 'body'
    )
  )
);

Important notes for those in the EU

Because of the way Akismet works (message, author, and other information sent to a third party) in some countries it's legally necessary to notify and gain the user's permission prior to verification., (*22)

To create a checkbox style authorisation prompt for this field set the following configuration option:, (*23)

config.yml, (*24)

SilverStripe\Akismet\AkismetSpamProtector:
  require_confirmation: true

_config.php, (*25)

Config::modify()->set(AkismetSpamProtector::class, 'require_confirmation', true);

The Versions

18/06 2018

dev-master

9999999-dev

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

11/06 2018

4.0.x-dev

4.0.9999999.9999999-dev

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

14/03 2018

4.0.1

4.0.1.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

22/02 2018

4.0.0

4.0.0.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

18/12 2017

4.0.0-beta1

4.0.0.0-beta1

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

18/12 2017

3.2.x-dev

3.2.9999999.9999999-dev

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

08/02 2017

3.2.6

3.2.6.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

08/02 2017

3.2.7

3.2.7.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

17/11 2016

3.2.5

3.2.5.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

17/08 2016

3.2.4

3.2.4.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

04/01 2016

3.2.3

3.2.3.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

19/11 2015

3.2.2

3.2.2.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

20/08 2015

3.2.1

3.2.1.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

26/05 2015

3.2.0

3.2.0.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe spam akismet

15/12 2014

3.1.x-dev

3.1.9999999.9999999-dev

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe spam akismet

03/12 2014

3.1.0

3.1.0.0

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe spam akismet

19/02 2014

3.0.x-dev

3.0.9999999.9999999-dev

Akismet antispam module for Silverstripe

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe spam akismet