Hi,
We’ve created a function which sets recaptcha entry for every new blog (public/private keys and other options).
Currently, with version 1.1.3 keypairs are not automatically included for new blogs (WordPress multisite).
For author (Khang Minh). Some of improvements that can be made with code below:
<?php
function cn_wpmu_create_blog ( $blog_id ) {
global $wpdb;
// get captcha private and public key from wp_options
$wp_options = $wpdb->get_var("SELECT option_value FROM wp_options WHERE option_name LIKE 'bwp_capt_general'");
$wp_options = unserialize($wp_options);
$public_key = $wp_options['input_pubkey'];
$private_key = $wp_options['input_prikey'];
$default_bwp_settings = array(
'input_pubkey' => $public_key,
'input_prikey' => $private_key,
'input_error' => '<strong>ERROR:</strong> Incorrect or empty reCAPTCHA response, please try again.',
'input_back' => 'Error: Incorrect or empty reCAPTCHA response, please click the back button on your browsers toolbar or click on %s to go back.',
'input_approved' => '1',
'enable_comment' => 'yes',
'enable_registration' => 'yes',
'enable_login' => '',
'enable_akismet' => '',
'use_global_keys' => '',
'select_cap' => 'manage_options' ,
'select_cf7_tag' => 'bwp-recaptcha' ,
'select_response' => 'redirect',
'select_position' => 'after_comment_field' ,
'select_akismet_react' => 'hold',
'hide_registered' => '',
'hide_cap' => '',
'hide_approved' => ''
);
$default_bwp_settings = serialize($default_bwp_settings);
$wpdb->insert(
'wp_' . $blog_id . '_options',
array(
'option_name' => 'bwp_capt_general',
'option_value' => $default_bwp_settings,
'autoload' => 'yes'
)
);
}
add_action ( 'wpmu_new_blog', 'cn_wpmu_create_blog' );
It would be ideal if you can make a check for keypairs (i.e. if they are exist in wp_config),
set warnings in blogs defined language (WPLANG in wp_$blogid_options), make checkboxes (on user interface)
for all options if global keypairs are used.
Thanks,
Bajro