• This plugin doesn’t seem to have been updated for 3.0.5, as it doesn’t save entered keys.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter huyz

    (@huyz)

    Right now, it looks like version 3.1.3 of the plugin cannot work for a multisite setup using WordPress 3.x.

    To understand why, the first thing to know is that there are two types of settings: network-wide and per-blog.

    The plugin’s multisite-handling code makes two mistakes:

    • It assumes that there’s a simple API for setting the network-wide settings just as easily as it’s done for the per-blog options. That API doesn’t yet exist. See https://wordpress.stackexchange.com/questions/18314/global-settings-page-for-multisite-plugin. The current code writes to the per-blog settings and then tries to read the network-wide settings. So now you know why saved keys (and other settings) will not be read back.
    • It tries to set/read all settings, whether network-wide or per-blog, using a single method (which as I described in the previous bullet point is broken). The plugin should use two separate methods depending on which settings page the admin is using: (a) read/write network-wide settings manually and (b) read/write per-bog settings using Settings API.

    In the meantime, here’s a workaround:

    Change wp-plugin.php:

    static function retrieve_options($options_name) {
                    return get_option($options_name);
            }
    
    static function remove_options($options_name) {
                    return delete_option($options_name);
            }
    static function add_options($options_name, $options) {
                    return add_option($options_name, $options);
            }

    While you’re at it, you might as well disable the “Super/Network Admin” settings page by changing recaptcha.php:

    function add_settings_page() {
                // add the options page
    /*
                if ($this->environment == Environment::WordPressMU && $this->is_authority())
                    add_submenu_page('wpmu-admin.php', 'WP-reCAPTCHA', 'WP-reCAPTCHA', 'manage_options', __FILE__, array(&$this, 'show_settings_page'));
    
                if ($this->environment == Environment::WordPressMS && $this->is_authority())
                    add_submenu_page('ms-admin.php', 'WP-reCAPTCHA', 'WP-reCAPTCHA', 'manage_options', __FILE__, array(&$this, 'show_settings_page'));
    */

    This will allow you to have separate per-blog wp-recaptcha settings. But it will not allow you to have network-wide settings.

    That seems to work great, thanks a lot!

    @huyz – thanks a ton, great plugin fix and great explanation.

    I assumed wp-plugin.php was a WP file so I was hesitant until I realized *both* of these file edits are in the actual plugin. Now all is peaceful again.

    Thx again

    While it seems like it makes it work, I can enter anything (or nothing) into the ReCaptcha entry field and it will send the form, and not fail (as it should).

    It also saves my keys/settings (and I select “Clean” for the form — and it shows me the “Red” one).

    Thread Starter huyz

    (@huyz)

    @robpoe
    It saves or doesn’t save your settings?
    What is “it”? The plugin as released, or the plugin with my patches?

    Aha, I found the issue. It wasn’t with your patches at all, it was with the contact-form-7-recaptcha-extension .. I had to remove a bunch of stuff from it (basically took out all the multisite code checking in it, too – to force it to be NON multi site).

    I’m using the wp-recaptcha plugin in conjunction with the contact-form-7 to try to help cut down spam on the contact forms (who would want to viagra spam a police department is beyond me!)…

    Anyway, if you’re wanting the fix, here it is:

    https://itofkc.net/WPASDPlugin.class.txt

    Drop that into your

    wp-content/plugins/contact-form-7-recaptcha-extension/includes/

    as

    WPASDPlugin.class.php

    (back up your old one first. This is for the version that lists itself as 0.0.8)

    By the way, thank you!!

    Thread Starter huyz

    (@huyz)

    For those who don’t want to touch the code, you can download the entire patched plugin at:

    https://github.com/huyz/wp-recaptcha/archives/oo-refactor

    would it help if I use my plugin (contact form 7 recaptcha extension) to copy the site options of wp-recaptcha to the blog options? something like

    if (is_multisite()) {
    update_option(get_site_option(...)));
    }

    then you don’t need to patch the whole thing by removing some code…

    I know it is maybe some kind of dirty, but if they update their plugin without fixing the bug you have to make a new fix…

    ah damn… that wouldn’t work ??

    from the second post with the new code, I just want to know, do we simply insert this code at the top of the said file? or do we replace the existing functions with these? or replace the whole file with just that code?

    Hi,

    after the hint I changed the code to match that solution. The current code only saves values blog local. The parts for the MS or MU are deactivated.

    But you can also replace the function or the file using the 7th or 8th post.

    I’am working on a version that matches the needs of MU / MS more precisely.

    Kind regards

    Andre

    No problem… You are more than welcome.

    As I said: I have adopted the code into the current version of the plugin. If you use the current version available you don’t have to patch something.

    Report back if you still have problems. I will take care of it in the next version.

    The current version of which plugin? I’m now a little confused. I’m talking about the reCAPTCHA plugin authored by BlaenkDenum. Are you involved with this project? I don’t see how you could edit his code, which I only downloaded today and is the stated 3.1.3.

    But now in having a look at what you’ve done, you’ve just killed the better part of my whole day redesigning my current theme’s contact form, because I wanted two different types of contact forms. Took me several hours to do, and now I just found your plugin which looks it would have done it perfectly! DOH!

    I now may just destroy my night and have a look at what you’ve done! LOL

    Hey… ??

    You are right, I am not involved with the WP-reCAPTCHA plugin.

    In this thread we discussed about an error handling options of WP MS/MU instances in connection with WP-reCAPTCHA. At the end we talked about a solution for the problem in my “Contact Form 7 reCAPTCHA Extension”. I thought you were talking about that too. Sorry for the confusion.

    The solution he mentions in the second post is applicable to every plugin that uses his code. The solution in the 7th and 8th post is especially for the people who use my plugin. Don’t mix them up.

    Ah… I don’t know how to respond to the second part of your post. Is it good that I have made my plugin or bad? LOL

    Anyway I hope it helps. ??

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Doesn't save keys for WordPress 3..05’ is closed to new replies.