-
-
Notifications
You must be signed in to change notification settings - Fork 27
en Hooks
Hooks allow to the user to extend the functional extent of a WordPress-Plugins. The following Hooks are deposited in Antispam Bee and can be addressed or controlled via code:
Extension of RegExp rules or regular expressions. This allows you to specify custom antispam rules that are adapted to the current type of spam at any time. Conclusion: Faster response with less spam. Nevertheless, we would be glad if you report this spam or if you pull the extension here on the GitHub repository.
Type: Array
Example:
function antispam_bee_patterns() {
add_filter( 'antispam_bee_patterns', 'antispam_bee_add_custom_patterns' );
}
add_action( 'init', 'antispam_bee_patterns' );
// Determine individual filters (author, host, body, ip, email). Separate multiple regular expressions with |
function antispam_bee_add_custom_patterns($patterns) {
// Autoren filtern
$patterns[] = array(
'author' => 'Autor1|Autor2|Autor3'
);
// Filter URL (example filters example.de.cool and example.de with and without www.)
$patterns[] = array(
'host' => '^(www\.)?example\.de\.cool$|^(www\.)?example\.de$'
);
// Filter comment content (example treats 3 or more links in the comment as spam)
$patterns[] = array(
'body' => '(.*(http|https|ftp|ftps)\:\/\/){3,}'
);
// Filter IP address (example filters 192.168.XXX.XXX)
$patterns[] = array(
'ip' => '^(192\.)(168\.)(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
);
// Filter e-mail address (example treats .xx or .xxx as spam)
$patterns[] = array(
'email' => '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.(xx|xxx)+$)'
);
return $patterns;
}
Define, who receives the notification email
Type: Array
Add another recipient:
function add_email_recipients( $recipients ) {
$recipients[] = '[email protected]';
return $recipients;
}
add_filter( 'antispam_bee_notification_recipients', 'add_email_recipients' );
Define new recipients:
function new_email_recipients( $old_recipients ) {
$new_recipients = array('[email protected]');
return $new_recipients;
}
add_filter( 'antispam_bee_notification_recipients', 'new_email_recipients' );
With this plugin filter the subject of the notification mails can be defined according to your own wishes.
Type: String
This filter can be used to change the languages in the dropdown for the feature Allow comments only in certain language.
Since: Antispam Bee 2.7.1
Type: Array
Example: Add Afrikaans to the list of languages
add_filter( 'ab_get_allowed_translate_languages', function( $languages ) {
$languages['af'] = 'Afrikaans';
return $languages;
});
All supported languages can be found on this Google support page.