Better WordPress reCAPTCHA (with no CAPTCHA reCAPTCHA)
Multisite Master API Keys (7 posts)

  1. anielsen
    Posted 1 year ago #

    I am using this plugin on a Multisite install of WordPress and was wondering if there was a way to store my API keys globally so that every site that activates this plugin has the keys pre-populated? Similar to how Gravity Forms does it: http://www.gravityhelp.com/documentation/page/Advanced_Configuration_Options

    I'd like to avoid making this a "must-use" plugin as I want my end users to be able to chose to activate it or not.



  2. bajro
    Posted 1 year ago #


    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:

    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);
                    'wp_' . $blog_id . '_options',
                            '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.


  3. Khang Minh
    Plugin Author

    Posted 1 year ago #

    Hmm currently any sub-blog will use the same key as the main blog, unless otherwise specified so I'm not sure if this is needed?

    See BWP_RECAPTCHA::init_recaptcha_keys()

  4. bajro
    Posted 1 year ago #

    Unfortunately, this doesn't work in our case. When a new blog is created, there is no row in database for recaptcha with name "bwp_capt_general" (and "bwp_capt_version either") for that new blog.
    When you click "BWP reCAPT" on user interface, that creates above mention rows in database (table wp_$blogid_options), but without global keypairs. Can you check plugin (version 1.1.3) with multisite enviroment?

    We have upgraded plugin with every new release, but with 1.1.3 that multisite feature doesn't work anymore. Last version that worked was 1.1.0 (but in that version keypairs was stored differently).

  5. Khang Minh
    Plugin Author

    Posted 1 year ago #

    That's weird because nothing related to multisite has been changed since 1.1.0. What you mentioned about missing option rows is expected as they are only created when needed, so a new blog should always use your network's key pair by default unless you set one for that blog.

    I will recheck this.

  6. edik
    Posted 1 year ago #

    I have the same problem. It affects many subblogs. New blogs and old blogs. Some of them use the global keys, others don't use the global keys. I don't know why.

    If I check the 'use global keys' check box of a blog which isn't using global keys and press enter, it has no effect. The blog still doesn't use the global keys.

  7. bajro
    Posted 1 year ago #

    I will recheck this.

    Can we do something more?
    If you want, you can contact me in PM and I'll give you access so you can test it out.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Better WordPress reCAPTCHA (with no CAPTCHA reCAPTCHA)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.