mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
FEATURE: added extension for new comments module
This commit is contained in:
parent
feddb2cc49
commit
237d08d5dd
17
_config.php
17
_config.php
@ -1,3 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
?>
|
/**
|
||||||
|
* Default configuration settings for the Spam Protection module.
|
||||||
|
*
|
||||||
|
* You should not put your own configuration in here rather use your
|
||||||
|
* mysite/_config.php file
|
||||||
|
*
|
||||||
|
* @package spamprotection
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(class_exists('Comment')) {
|
||||||
|
/**
|
||||||
|
* If the comments module is installed then add the spam protection module
|
||||||
|
* to the comments form via this extension
|
||||||
|
*/
|
||||||
|
Object::add_extension('CommentingController', 'CommentSpamProtection');
|
||||||
|
}
|
23
code/extensions/CommentSpamProtection.php
Normal file
23
code/extensions/CommentSpamProtection.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the spam protection to the comments module if it is installed
|
||||||
|
*
|
||||||
|
* @package spamprotection
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CommentSpamProtection extends Extension {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the AJAX commenting and update the form
|
||||||
|
* with the {@link SpamProtectorField} which is enabled
|
||||||
|
*/
|
||||||
|
function alterCommentForm(&$form) {
|
||||||
|
SpamProtectorManager::update_form($form, null, array(
|
||||||
|
'Name' => 'author_name',
|
||||||
|
'CommenterURL' => 'author_url',
|
||||||
|
'Comment' => 'post_body',
|
||||||
|
'Email' => 'author_email'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user