Setting Bad Behavior values on site creation

  • 06/05/2013

Contrary to Akismet, it’s not easy to set the global key for Bad Behavior HTTP:BL.

But we can do it setting the value on site creation using the hook wpmu_new_blog.

bad behavior configuration screen


Setting the value automagically in multisite.

<?php
/*
	Plugin Name: Copy Bad Behavior key on site creation
	Version: 0.1
	Author: Rodolfo Buaiz
	Author URI: http://www.rodbuaiz.com
*/

add_action(
	'wpmu_new_blog',
	function( $blog_id, $user_id, $domain, $path, $site_id, $meta )
	{
	    switch_to_blog( $blog_id );
		$bb['httpbl_key'] = 'MY-BB-HTTPBL';
		$bb['eu_cookie'] = true;
	    update_option( 'bad_behavior_settings', $bb );
	    restore_current_blog();
	},
	10, 6
);

Leave a reply

This entry was posted in Hacks and tagged on .